paperlab 0.5.0 → 0.5.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/dist/stage.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  LightRig,
4
4
  PaperFieldMesh,
5
5
  PaperLighting,
6
+ ReleaseContextOnUnmount,
6
7
  createWalkPath,
7
8
  cssColorOr,
8
9
  diffConfig,
@@ -15,7 +16,7 @@ import {
15
16
  resolveLighting,
16
17
  usePrefersReducedMotion,
17
18
  walkPathSchema
18
- } from "./chunk-6IADJZX5.js";
19
+ } from "./chunk-HRXQTJFS.js";
19
20
 
20
21
  // src/stage/PaperStage.tsx
21
22
  import * as THREE6 from "three";
@@ -485,8 +486,7 @@ function makeGlowTexture(color) {
485
486
  const ctx = canvas.getContext("2d");
486
487
  const glow = ctx.createRadialGradient(size / 2, size / 2, 0, size / 2, size / 2, size / 2);
487
488
  const c = new THREE3.Color(color);
488
- const rgb = `${c.r * 255 | 0}, ${c.g * 255 | 0}, ${c.b * 255 | 0}`;
489
- for (const [stop, alpha] of [
489
+ for (const [stop, level] of [
490
490
  [0, 1],
491
491
  [0.5, 1],
492
492
  [0.62, 0.66],
@@ -495,7 +495,8 @@ function makeGlowTexture(color) {
495
495
  [0.94, 0.03],
496
496
  [1, 0]
497
497
  ]) {
498
- glow.addColorStop(stop, `rgba(${rgb}, ${alpha})`);
498
+ const scaled = `${c.r * 255 * level | 0}, ${c.g * 255 * level | 0}, ${c.b * 255 * level | 0}`;
499
+ glow.addColorStop(stop, `rgb(${scaled})`);
499
500
  }
500
501
  ctx.fillStyle = glow;
501
502
  ctx.fillRect(0, 0, size, size);
@@ -520,6 +521,7 @@ function Source({
520
521
  {
521
522
  map: texture,
522
523
  transparent: true,
524
+ blending: THREE3.AdditiveBlending,
523
525
  color: new THREE3.Color(intensity, intensity, intensity),
524
526
  depthWrite: false,
525
527
  fog: false
@@ -1694,7 +1696,8 @@ function PaperStage({ children, className, style, ...sceneProps }) {
1694
1696
  },
1695
1697
  children: [
1696
1698
  /* @__PURE__ */ jsx7(PaperStageScene, { ...sceneProps }),
1697
- children
1699
+ children,
1700
+ /* @__PURE__ */ jsx7(ReleaseContextOnUnmount, {})
1698
1701
  ]
1699
1702
  }
1700
1703
  ) });
@@ -2067,7 +2070,11 @@ function describeStage(input) {
2067
2070
  );
2068
2071
  const moved = Object.entries(stage.light).filter(([, value]) => value !== void 0).map(([key]) => key);
2069
2072
  if (moved.length > 0) parts.push(`with its ${moved.join(", ")} set by hand`);
2070
- if (input.scroll) parts.push("and scrolling the page walks the figure deeper into it");
2073
+ if (input.scroll) {
2074
+ parts.push(
2075
+ stage.showFigure ? "and scrolling the page walks the figure deeper into it" : "and scrolling the page carries the camera deeper into it"
2076
+ );
2077
+ }
2071
2078
  return parts.join(", ");
2072
2079
  }
2073
2080
  function exportableImages(images) {
@@ -2108,6 +2115,7 @@ const banner = ${stringifyStage(diffConfig(paperConfigSchema.parse(input.paper))
2108
2115
  const textConst = input.text?.trim() ? `
2109
2116
 
2110
2117
  const text = ${JSON.stringify(input.text)}` : "";
2118
+ const scrolls = stageSchema.parse(input.stage).showFigure ? "walk the figure" : "move the camera";
2111
2119
  const images = input.images?.length ? exportableImages(input.images) : null;
2112
2120
  const imagesConst = images ? `
2113
2121
  ${images.substituted ? "\n// Your uploaded pictures cannot travel in a snippet \u2014 these are\n// placeholders in the same order. Point them at your own files." : ""}
@@ -2134,7 +2142,7 @@ export function ${name}() {
2134
2142
  const ref = useRef<HTMLDivElement>(null)
2135
2143
  const [progress, setProgress] = useState(0)
2136
2144
 
2137
- // Scroll the section, walk the figure. The stage is pinned for the height
2145
+ // Scroll the section, ${scrolls}. The stage is pinned for the height
2138
2146
  // of the section, so the page scrolling past it IS the walk.
2139
2147
  useEffect(() => {
2140
2148
  const el = ref.current
@@ -2171,7 +2179,8 @@ function buildStageAgentPayload(input) {
2171
2179
  heights of scroll and pins the canvas inside that. Drop it into the page
2172
2180
  flow as a section; do NOT wrap it in a fixed-height container.` : `4. Sizing: the component fills its parent container. Place it where I ask;
2173
2181
  give the parent an explicit height.`;
2174
- return `Integrate a Paperlab stage \u2014 paper as architecture, with a figure walking through it \u2014 into this project. (paperlab agent-payload v${AGENT_PAYLOAD_VERSION})
2182
+ const subject = stageSchema.parse(input.stage).showFigure ? "paper as architecture, with a figure walking through it" : "paper as architecture, banners hung along a walk you move through";
2183
+ return `Integrate a Paperlab stage \u2014 ${subject} \u2014 into this project. (paperlab agent-payload v${AGENT_PAYLOAD_VERSION})
2175
2184
 
2176
2185
  1. Install the dependencies:
2177
2186