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/dist/stage.js CHANGED
@@ -16,7 +16,8 @@ import {
16
16
  resolveLighting,
17
17
  usePrefersReducedMotion,
18
18
  walkPathSchema
19
- } from "./chunk-HRXQTJFS.js";
19
+ } from "./chunk-MZCAN3AR.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
@@ -958,9 +937,9 @@ var stageRoomSchema = z3.object({
958
937
  height: z3.number().min(1).max(6).default(2.2),
959
938
  color: z3.string().default("#171310").describe("color"),
960
939
  /** Columns flanking the walk — see `stageColumnsSchema`. */
961
- columns: stageColumnsSchema.default({}),
940
+ columns: stageColumnsSchema.prefault({}),
962
941
  /** A wall at the end of the walk with the source in it. */
963
- doorway: stageDoorwaySchema.default({})
942
+ doorway: stageDoorwaySchema.prefault({})
964
943
  });
965
944
  var stageGradeSchema = z3.object({
966
945
  /**
@@ -1014,9 +993,9 @@ var stageGradeSchema = z3.object({
1014
993
  grain: z3.number().min(0).max(0.5).default(0.022)
1015
994
  });
1016
995
  var stageSchema = z3.object({
1017
- path: walkPathSchema.default({}),
1018
- shot: shotSchema.default({}),
1019
- figure: figureSchema.default({}),
996
+ path: walkPathSchema.prefault({}),
997
+ shot: shotSchema.prefault({}),
998
+ figure: figureSchema.prefault({}),
1020
999
  /** Stage mode is built for `nave`; the others are all front-lit. */
1021
1000
  lighting: z3.enum(lightingNames).default("nave"),
1022
1001
  /**
@@ -1043,12 +1022,12 @@ var stageSchema = z3.object({
1043
1022
  * Still one flag away for anyone who wants it.
1044
1023
  */
1045
1024
  showFigure: z3.boolean().default(false),
1046
- source: stageSourceSchema.default({}),
1047
- ground: stageGroundSchema.default({}),
1025
+ source: stageSourceSchema.prefault({}),
1026
+ ground: stageGroundSchema.prefault({}),
1048
1027
  /** Ceiling and the architecture around the walk — see `stageRoomSchema`. */
1049
- room: stageRoomSchema.default({}),
1028
+ room: stageRoomSchema.prefault({}),
1050
1029
  /** Thread and clips — see `stageSuspensionSchema`. */
1051
- suspension: stageSuspensionSchema.default({}),
1030
+ suspension: stageSuspensionSchema.prefault({}),
1052
1031
  /**
1053
1032
  * The print — bloom, vignette, grain.
1054
1033
  *
@@ -1060,7 +1039,7 @@ var stageSchema = z3.object({
1060
1039
  * behaviour: a stage silently losing its grade would be worse than a
1061
1040
  * missing-module error that names the package.
1062
1041
  */
1063
- grade: stageGradeSchema.default({})
1042
+ grade: stageGradeSchema.prefault({})
1064
1043
  });
1065
1044
 
1066
1045
  // src/stage/navigate.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>,