paperlab 0.6.0 → 0.7.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/dist/stage.js CHANGED
@@ -16,7 +16,8 @@ import {
16
16
  resolveLighting,
17
17
  usePrefersReducedMotion,
18
18
  walkPathSchema
19
- } from "./chunk-E22ILEDO.js";
19
+ } from "./chunk-NTDVOOBA.js";
20
+ import "./chunk-7TLIWPGM.js";
20
21
 
21
22
  // src/stage/PaperStage.tsx
22
23
  import * as THREE6 from "three";
@@ -789,50 +790,28 @@ function Suspension({
789
790
  ] });
790
791
  }
791
792
 
792
- // src/stage/Grade.tsx
793
- import {
794
- EffectComposer,
795
- Bloom,
796
- DepthOfField,
797
- Vignette,
798
- Noise,
799
- ToneMapping
800
- } from "@react-three/postprocessing";
801
- import { BlendFunction, ToneMappingMode } from "postprocessing";
802
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
803
- var toneMappingModes = {
804
- agx: ToneMappingMode.AGX,
805
- neutral: ToneMappingMode.NEUTRAL,
806
- filmic: ToneMappingMode.ACES_FILMIC
807
- };
808
- function Grade({ grade, film }) {
809
- const bloom = grade.bloom > 0;
810
- const depth = grade.depth > 0;
811
- const vignette = grade.vignette > 0;
812
- const grain = grade.grain > 0;
813
- if (!bloom && !depth && !vignette && !grain) return null;
814
- return /* @__PURE__ */ jsxs5(EffectComposer, { children: [
815
- bloom ? /* @__PURE__ */ jsx6(
816
- Bloom,
817
- {
818
- intensity: grade.bloom,
819
- luminanceThreshold: grade.threshold,
820
- luminanceSmoothing: 0.22,
821
- mipmapBlur: true
822
- }
823
- ) : null,
824
- depth ? /* @__PURE__ */ jsx6(
825
- DepthOfField,
826
- {
827
- focusDistance: 8e-3,
828
- focalLength: 0.02 + grade.depth * 0.04,
829
- bokehScale: grade.depth * 2.5
830
- }
831
- ) : null,
832
- /* @__PURE__ */ jsx6(ToneMapping, { mode: toneMappingModes[film] }),
833
- vignette ? /* @__PURE__ */ jsx6(Vignette, { offset: 0.32, darkness: grade.vignette }) : null,
834
- grain ? /* @__PURE__ */ jsx6(Noise, { opacity: grade.grain, blendFunction: BlendFunction.OVERLAY }) : null
835
- ] });
793
+ // src/stage/GradeLazy.tsx
794
+ import { Suspense as Suspense2, lazy } from "react";
795
+ import { jsx as jsx6 } from "react/jsx-runtime";
796
+ var Grade = lazy(
797
+ () => import("./Grade-SBGYELKV.js").then((m) => ({ default: m.Grade })).catch((error) => {
798
+ warnOnce(error);
799
+ return { default: (() => null) };
800
+ })
801
+ );
802
+ var warned = false;
803
+ function warnOnce(cause) {
804
+ if (warned) return;
805
+ warned = true;
806
+ console.warn(
807
+ "[paperlab/stage] Rendering without the print pass \u2014 tone curve, bloom, vignette and grain are off.\nThey need two optional peers:\n npm i @react-three/postprocessing postprocessing\nSet `grade` to all zeros to turn the pass off deliberately and silence this.",
808
+ ...cause === void 0 ? [] : [cause]
809
+ );
810
+ }
811
+ function GradePass(props) {
812
+ const { bloom, depth, vignette, grain } = props.grade;
813
+ if (!(bloom > 0 || depth > 0 || vignette > 0 || grain > 0)) return null;
814
+ return /* @__PURE__ */ jsx6(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx6(Grade, { ...props }) });
836
815
  }
837
816
 
838
817
  // src/stage/schema.ts
@@ -1389,7 +1368,7 @@ function settleTier(tier, fps, failed) {
1389
1368
  }
1390
1369
 
1391
1370
  // src/stage/PaperStage.tsx
1392
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1371
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1393
1372
  var stageBanner = {
1394
1373
  sheet: { width: 1.5, height: 8.5, segments: "auto" },
1395
1374
  stock: "vellum",
@@ -1589,7 +1568,7 @@ function PaperStageScene({
1589
1568
  const size = paperHeight * stage.source.spread;
1590
1569
  return { position: [x, size * 0.35, z6], yaw: Math.atan2(-tx, -tz), size };
1591
1570
  }, [path, stage.source.beyond, stage.source.spread, paperHeight]);
1592
- return /* @__PURE__ */ jsxs6(LightRig, { rig, children: [
1571
+ return /* @__PURE__ */ jsxs5(LightRig, { rig, children: [
1593
1572
  /* @__PURE__ */ jsx7(ShotRig, { stage, paperHeight, walk: walk.walk }),
1594
1573
  /* @__PURE__ */ jsx7(
1595
1574
  PaperLighting,
@@ -1680,12 +1659,12 @@ function PaperStageScene({
1680
1659
  frozen: reducedMotion
1681
1660
  }
1682
1661
  ),
1683
- settings.grade && /* @__PURE__ */ jsx7(Grade, { grade: stage.grade, film: rig.film })
1662
+ settings.grade && /* @__PURE__ */ jsx7(GradePass, { grade: stage.grade, film: rig.film })
1684
1663
  ] });
1685
1664
  }
1686
1665
  function PaperStage({ children, className, style, ...sceneProps }) {
1687
1666
  const dpr = qualityFor(sceneProps.quality ?? "auto").dpr;
1688
- return /* @__PURE__ */ jsx7("div", { className, style: { width: "100%", height: "100%", ...style }, children: /* @__PURE__ */ jsxs6(
1667
+ return /* @__PURE__ */ jsx7("div", { className, style: { width: "100%", height: "100%", ...style }, children: /* @__PURE__ */ jsxs5(
1689
1668
  Canvas,
1690
1669
  {
1691
1670
  shadows: true,
@@ -2187,8 +2166,9 @@ function buildStageAgentPayload(input) {
2187
2166
  npm i paperlab three @react-three/fiber gsap @react-three/postprocessing postprocessing
2188
2167
 
2189
2168
  The last two are only needed by stage mode \u2014 <Paper> and <PaperField> do
2190
- not use them \u2014 but <PaperStage> imports the print pass (bloom, tone curve,
2191
- vignette, grain), so a stage will not build without them.
2169
+ not use them \u2014 and they are optional even here: <PaperStage> loads the
2170
+ print pass on demand, so a stage without them renders, just without the
2171
+ tone curve, bloom, vignette and grain. Install them to get the grade.
2192
2172
 
2193
2173
  2. Create the component below as \`components/${name}.tsx\` (or the project's
2194
2174
  component convention). It is self-contained \u2014 it owns its own <Canvas>,