paperlab 0.4.0 → 0.5.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { F as FieldPaperSlot, a as PaperConfigInput } from './slots-BYoLxVZ4.cjs';
2
+ import { F as FieldPaperSlot, a as PaperConfigInput } from './slots-CIo7FnlY.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -218,15 +218,15 @@ declare const stageSchema: z.ZodObject<{
218
218
  spread: z.ZodDefault<z.ZodNumber>;
219
219
  }, "strip", z.ZodTypeAny, {
220
220
  color: string;
221
- enabled: boolean;
222
221
  spread: number;
222
+ enabled: boolean;
223
223
  zenith: string;
224
224
  beyond: number;
225
225
  surround: boolean;
226
226
  }, {
227
227
  color?: string | undefined;
228
- enabled?: boolean | undefined;
229
228
  spread?: number | undefined;
229
+ enabled?: boolean | undefined;
230
230
  zenith?: string | undefined;
231
231
  beyond?: number | undefined;
232
232
  surround?: boolean | undefined;
@@ -478,6 +478,17 @@ declare const stageSchema: z.ZodObject<{
478
478
  closed: boolean;
479
479
  };
480
480
  lighting: "studio" | "window" | "leaves" | "goldenhour" | "noir" | "nave" | "raking" | "lightbox";
481
+ light: {
482
+ key?: number | undefined;
483
+ height?: number | undefined;
484
+ color?: string | undefined;
485
+ studio?: number | undefined;
486
+ exposure?: number | undefined;
487
+ film?: "agx" | "neutral" | "filmic" | undefined;
488
+ direction?: number | undefined;
489
+ ambient?: number | undefined;
490
+ haze?: number | undefined;
491
+ };
481
492
  figure: {
482
493
  height: number;
483
494
  speed: number;
@@ -490,23 +501,12 @@ declare const stageSchema: z.ZodObject<{
490
501
  };
491
502
  source: {
492
503
  color: string;
493
- enabled: boolean;
494
504
  spread: number;
505
+ enabled: boolean;
495
506
  zenith: string;
496
507
  beyond: number;
497
508
  surround: boolean;
498
509
  };
499
- light: {
500
- key?: number | undefined;
501
- height?: number | undefined;
502
- color?: string | undefined;
503
- studio?: number | undefined;
504
- exposure?: number | undefined;
505
- film?: "agx" | "neutral" | "filmic" | undefined;
506
- direction?: number | undefined;
507
- ambient?: number | undefined;
508
- haze?: number | undefined;
509
- };
510
510
  shot: {
511
511
  height: number;
512
512
  offset: number;
@@ -555,6 +555,17 @@ declare const stageSchema: z.ZodObject<{
555
555
  closed?: boolean | undefined;
556
556
  } | undefined;
557
557
  lighting?: "studio" | "window" | "leaves" | "goldenhour" | "noir" | "nave" | "raking" | "lightbox" | undefined;
558
+ light?: {
559
+ key?: number | undefined;
560
+ height?: number | undefined;
561
+ color?: string | undefined;
562
+ studio?: number | undefined;
563
+ exposure?: number | undefined;
564
+ film?: "agx" | "neutral" | "filmic" | undefined;
565
+ direction?: number | undefined;
566
+ ambient?: number | undefined;
567
+ haze?: number | undefined;
568
+ } | undefined;
558
569
  figure?: {
559
570
  height?: number | undefined;
560
571
  speed?: number | undefined;
@@ -567,23 +578,12 @@ declare const stageSchema: z.ZodObject<{
567
578
  } | undefined;
568
579
  source?: {
569
580
  color?: string | undefined;
570
- enabled?: boolean | undefined;
571
581
  spread?: number | undefined;
582
+ enabled?: boolean | undefined;
572
583
  zenith?: string | undefined;
573
584
  beyond?: number | undefined;
574
585
  surround?: boolean | undefined;
575
586
  } | undefined;
576
- light?: {
577
- key?: number | undefined;
578
- height?: number | undefined;
579
- color?: string | undefined;
580
- studio?: number | undefined;
581
- exposure?: number | undefined;
582
- film?: "agx" | "neutral" | "filmic" | undefined;
583
- direction?: number | undefined;
584
- ambient?: number | undefined;
585
- haze?: number | undefined;
586
- } | undefined;
587
587
  shot?: {
588
588
  height?: number | undefined;
589
589
  offset?: number | undefined;
@@ -739,6 +739,28 @@ declare const qualityNames: readonly ["auto", "low", "medium", "high"];
739
739
  type QualityName = (typeof qualityNames)[number];
740
740
  type QualityTier = Exclude<QualityName, 'auto'>;
741
741
 
742
+ /**
743
+ * Stage mode: paper as architecture, with a figure walking through it.
744
+ *
745
+ * The one guarantee worth stating — every part of the scene reads the SAME
746
+ * walk. The layout arranges along it, the figure follows it, the camera is
747
+ * stationed on it, and the source stands at the end of it. Handing those
748
+ * four their own copies of a path is the failure this component exists to
749
+ * prevent: a colonnade whose aisle the figure does not walk down is not a
750
+ * near-miss, it is a completely different picture.
751
+ */
752
+ /** A banner: tall, translucent, with folds running the length of its drop. */
753
+ /**
754
+ * The sheet a stage hangs when the caller does not name one.
755
+ *
756
+ * Exported because it is the base anyone RESHAPING a banner has to start
757
+ * from. A caller who wants a wider drop wants this stock, this grain and
758
+ * this drape with different dimensions — and rebuilding it from the schema
759
+ * defaults instead gives a sheet of printer paper with no fold in it, which
760
+ * is a different object. A second copy of these numbers in a caller is a
761
+ * copy free to drift from the one the scene actually falls back to.
762
+ */
763
+ declare const stageBanner: PaperConfigInput;
742
764
  interface PaperStageSceneProps {
743
765
  /** Walk, shot, figure, lighting — see `stageSchema`. */
744
766
  stage?: StageConfigInput;
@@ -962,6 +984,8 @@ interface StageExportInput {
962
984
  paper?: PaperConfigInput;
963
985
  /** The words the space is built from. Omitted renders blank banners. */
964
986
  text?: string;
987
+ /** Pictures on the banners, one per drop, instead of words. */
988
+ images?: string[];
965
989
  count?: number;
966
990
  /** Bind the walk to page scroll, pinned, rather than to the clock. */
967
991
  scroll?: boolean;
@@ -977,4 +1001,4 @@ declare function buildStageComponentSource(input: StageExportInput): string;
977
1001
  /** The self-contained stage integration brief — one paste into a coding agent. */
978
1002
  declare function buildStageAgentPayload(input: StageExportInput): string;
979
1003
 
980
- export { type Ground, PaperStage, type PaperStageProps, PaperStageScene, type PaperStageSceneProps, type QualityName, type QualityTier, type ShotName, type ShotOptions, type StageConfig, type StageConfigInput, type StageExportInput, type StageGradeConfig, type StageMotion, type StageMotionInput, type StagePreset, type StageScale, type StageShot, type WalkName, type WalkPath, type WalkPathOptions, buildStageAgentPayload, buildStageComponentSource, createWalkPath, describeStage, diffStage, getStagePreset, getWalk, listStagePresets, qualityNames, shotNames, stagePresets, stageSchema, walkNames, walks };
1004
+ export { type Ground, PaperStage, type PaperStageProps, PaperStageScene, type PaperStageSceneProps, type QualityName, type QualityTier, type ShotName, type ShotOptions, type StageConfig, type StageConfigInput, type StageExportInput, type StageGradeConfig, type StageMotion, type StageMotionInput, type StagePreset, type StageScale, type StageShot, type WalkName, type WalkPath, type WalkPathOptions, buildStageAgentPayload, buildStageComponentSource, createWalkPath, describeStage, diffStage, getStagePreset, getWalk, listStagePresets, qualityNames, shotNames, stageBanner, stagePresets, stageSchema, walkNames, walks };
package/dist/stage.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { F as FieldPaperSlot, a as PaperConfigInput } from './slots-BYoLxVZ4.js';
2
+ import { F as FieldPaperSlot, a as PaperConfigInput } from './slots-CIo7FnlY.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -218,15 +218,15 @@ declare const stageSchema: z.ZodObject<{
218
218
  spread: z.ZodDefault<z.ZodNumber>;
219
219
  }, "strip", z.ZodTypeAny, {
220
220
  color: string;
221
- enabled: boolean;
222
221
  spread: number;
222
+ enabled: boolean;
223
223
  zenith: string;
224
224
  beyond: number;
225
225
  surround: boolean;
226
226
  }, {
227
227
  color?: string | undefined;
228
- enabled?: boolean | undefined;
229
228
  spread?: number | undefined;
229
+ enabled?: boolean | undefined;
230
230
  zenith?: string | undefined;
231
231
  beyond?: number | undefined;
232
232
  surround?: boolean | undefined;
@@ -478,6 +478,17 @@ declare const stageSchema: z.ZodObject<{
478
478
  closed: boolean;
479
479
  };
480
480
  lighting: "studio" | "window" | "leaves" | "goldenhour" | "noir" | "nave" | "raking" | "lightbox";
481
+ light: {
482
+ key?: number | undefined;
483
+ height?: number | undefined;
484
+ color?: string | undefined;
485
+ studio?: number | undefined;
486
+ exposure?: number | undefined;
487
+ film?: "agx" | "neutral" | "filmic" | undefined;
488
+ direction?: number | undefined;
489
+ ambient?: number | undefined;
490
+ haze?: number | undefined;
491
+ };
481
492
  figure: {
482
493
  height: number;
483
494
  speed: number;
@@ -490,23 +501,12 @@ declare const stageSchema: z.ZodObject<{
490
501
  };
491
502
  source: {
492
503
  color: string;
493
- enabled: boolean;
494
504
  spread: number;
505
+ enabled: boolean;
495
506
  zenith: string;
496
507
  beyond: number;
497
508
  surround: boolean;
498
509
  };
499
- light: {
500
- key?: number | undefined;
501
- height?: number | undefined;
502
- color?: string | undefined;
503
- studio?: number | undefined;
504
- exposure?: number | undefined;
505
- film?: "agx" | "neutral" | "filmic" | undefined;
506
- direction?: number | undefined;
507
- ambient?: number | undefined;
508
- haze?: number | undefined;
509
- };
510
510
  shot: {
511
511
  height: number;
512
512
  offset: number;
@@ -555,6 +555,17 @@ declare const stageSchema: z.ZodObject<{
555
555
  closed?: boolean | undefined;
556
556
  } | undefined;
557
557
  lighting?: "studio" | "window" | "leaves" | "goldenhour" | "noir" | "nave" | "raking" | "lightbox" | undefined;
558
+ light?: {
559
+ key?: number | undefined;
560
+ height?: number | undefined;
561
+ color?: string | undefined;
562
+ studio?: number | undefined;
563
+ exposure?: number | undefined;
564
+ film?: "agx" | "neutral" | "filmic" | undefined;
565
+ direction?: number | undefined;
566
+ ambient?: number | undefined;
567
+ haze?: number | undefined;
568
+ } | undefined;
558
569
  figure?: {
559
570
  height?: number | undefined;
560
571
  speed?: number | undefined;
@@ -567,23 +578,12 @@ declare const stageSchema: z.ZodObject<{
567
578
  } | undefined;
568
579
  source?: {
569
580
  color?: string | undefined;
570
- enabled?: boolean | undefined;
571
581
  spread?: number | undefined;
582
+ enabled?: boolean | undefined;
572
583
  zenith?: string | undefined;
573
584
  beyond?: number | undefined;
574
585
  surround?: boolean | undefined;
575
586
  } | undefined;
576
- light?: {
577
- key?: number | undefined;
578
- height?: number | undefined;
579
- color?: string | undefined;
580
- studio?: number | undefined;
581
- exposure?: number | undefined;
582
- film?: "agx" | "neutral" | "filmic" | undefined;
583
- direction?: number | undefined;
584
- ambient?: number | undefined;
585
- haze?: number | undefined;
586
- } | undefined;
587
587
  shot?: {
588
588
  height?: number | undefined;
589
589
  offset?: number | undefined;
@@ -739,6 +739,28 @@ declare const qualityNames: readonly ["auto", "low", "medium", "high"];
739
739
  type QualityName = (typeof qualityNames)[number];
740
740
  type QualityTier = Exclude<QualityName, 'auto'>;
741
741
 
742
+ /**
743
+ * Stage mode: paper as architecture, with a figure walking through it.
744
+ *
745
+ * The one guarantee worth stating — every part of the scene reads the SAME
746
+ * walk. The layout arranges along it, the figure follows it, the camera is
747
+ * stationed on it, and the source stands at the end of it. Handing those
748
+ * four their own copies of a path is the failure this component exists to
749
+ * prevent: a colonnade whose aisle the figure does not walk down is not a
750
+ * near-miss, it is a completely different picture.
751
+ */
752
+ /** A banner: tall, translucent, with folds running the length of its drop. */
753
+ /**
754
+ * The sheet a stage hangs when the caller does not name one.
755
+ *
756
+ * Exported because it is the base anyone RESHAPING a banner has to start
757
+ * from. A caller who wants a wider drop wants this stock, this grain and
758
+ * this drape with different dimensions — and rebuilding it from the schema
759
+ * defaults instead gives a sheet of printer paper with no fold in it, which
760
+ * is a different object. A second copy of these numbers in a caller is a
761
+ * copy free to drift from the one the scene actually falls back to.
762
+ */
763
+ declare const stageBanner: PaperConfigInput;
742
764
  interface PaperStageSceneProps {
743
765
  /** Walk, shot, figure, lighting — see `stageSchema`. */
744
766
  stage?: StageConfigInput;
@@ -962,6 +984,8 @@ interface StageExportInput {
962
984
  paper?: PaperConfigInput;
963
985
  /** The words the space is built from. Omitted renders blank banners. */
964
986
  text?: string;
987
+ /** Pictures on the banners, one per drop, instead of words. */
988
+ images?: string[];
965
989
  count?: number;
966
990
  /** Bind the walk to page scroll, pinned, rather than to the clock. */
967
991
  scroll?: boolean;
@@ -977,4 +1001,4 @@ declare function buildStageComponentSource(input: StageExportInput): string;
977
1001
  /** The self-contained stage integration brief — one paste into a coding agent. */
978
1002
  declare function buildStageAgentPayload(input: StageExportInput): string;
979
1003
 
980
- export { type Ground, PaperStage, type PaperStageProps, PaperStageScene, type PaperStageSceneProps, type QualityName, type QualityTier, type ShotName, type ShotOptions, type StageConfig, type StageConfigInput, type StageExportInput, type StageGradeConfig, type StageMotion, type StageMotionInput, type StagePreset, type StageScale, type StageShot, type WalkName, type WalkPath, type WalkPathOptions, buildStageAgentPayload, buildStageComponentSource, createWalkPath, describeStage, diffStage, getStagePreset, getWalk, listStagePresets, qualityNames, shotNames, stagePresets, stageSchema, walkNames, walks };
1004
+ export { type Ground, PaperStage, type PaperStageProps, PaperStageScene, type PaperStageSceneProps, type QualityName, type QualityTier, type ShotName, type ShotOptions, type StageConfig, type StageConfigInput, type StageExportInput, type StageGradeConfig, type StageMotion, type StageMotionInput, type StagePreset, type StageScale, type StageShot, type WalkName, type WalkPath, type WalkPathOptions, buildStageAgentPayload, buildStageComponentSource, createWalkPath, describeStage, diffStage, getStagePreset, getWalk, listStagePresets, qualityNames, shotNames, stageBanner, stagePresets, stageSchema, walkNames, walks };
package/dist/stage.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  resolveLighting,
16
16
  usePrefersReducedMotion,
17
17
  walkPathSchema
18
- } from "./chunk-4ZU5DZEF.js";
18
+ } from "./chunk-6IADJZX5.js";
19
19
 
20
20
  // src/stage/PaperStage.tsx
21
21
  import * as THREE6 from "three";
@@ -136,7 +136,7 @@ var figureSchema = z2.object({
136
136
  /** Arm swing, 0..1. Drop it toward 0 for hands-in-pockets stillness. */
137
137
  swing: z2.number().min(0).max(1).default(1),
138
138
  /** Silhouette color. Near-black by default: it should read as an absence, not an object. */
139
- color: z2.string().default("#0a0a0c"),
139
+ color: z2.string().default("#0a0a0c").describe("color"),
140
140
  /**
141
141
  * How the figure takes light.
142
142
  *
@@ -838,7 +838,7 @@ import { z as z3 } from "zod";
838
838
  var stageSourceSchema = z3.object({
839
839
  /** The bright void the walk resolves toward. Without it the vanishing point is a hole. */
840
840
  enabled: z3.boolean().default(true),
841
- color: z3.string().default("#fff4e2"),
841
+ color: z3.string().default("#fff4e2").describe("color"),
842
842
  /** How far past the end of the walk it stands, world units. */
843
843
  beyond: z3.number().min(0).max(80).default(10),
844
844
  /**
@@ -870,7 +870,7 @@ var stageGroundSchema = z3.object({
870
870
  * kept its contrast against the source and gained a surface you can read
871
871
  * the size of the room from.
872
872
  */
873
- color: z3.string().default("#241e19"),
873
+ color: z3.string().default("#241e19").describe("color"),
874
874
  /**
875
875
  * Width of one poured slab, in world units. 0 leaves the floor unseamed.
876
876
  *
@@ -894,7 +894,7 @@ var stageSuspensionSchema = z3.object({
894
894
  * paper is meant to be impossible.
895
895
  */
896
896
  type: z3.enum(["none", "thread", "rod"]).default("thread"),
897
- color: z3.string().default("#9c948a"),
897
+ color: z3.string().default("#9c948a").describe("color"),
898
898
  /**
899
899
  * What grips the sheet.
900
900
  *
@@ -935,13 +935,13 @@ var stageColumnsSchema = z3.object({
935
935
  * more banners, and the eye stops being able to tell what the room is made
936
936
  * of from what is hanging in it.
937
937
  */
938
- color: z3.string().default("#5c554d")
938
+ color: z3.string().default("#5c554d").describe("color")
939
939
  });
940
940
  var stageDoorwaySchema = z3.object({
941
941
  enabled: z3.boolean().default(false),
942
942
  /** Opening size, as a multiple of the source's own. 1 frames it exactly. */
943
943
  opening: z3.number().min(0.2).max(3).default(1.05),
944
- color: z3.string().default("#171310")
944
+ color: z3.string().default("#171310").describe("color")
945
945
  });
946
946
  var stageRoomSchema = z3.object({
947
947
  enabled: z3.boolean().default(true),
@@ -954,7 +954,7 @@ var stageRoomSchema = z3.object({
954
954
  * happened to be scaled to that day.
955
955
  */
956
956
  height: z3.number().min(1).max(6).default(2.2),
957
- color: z3.string().default("#171310"),
957
+ color: z3.string().default("#171310").describe("color"),
958
958
  /** Columns flanking the walk — see `stageColumnsSchema`. */
959
959
  columns: stageColumnsSchema.default({}),
960
960
  /** A wall at the end of the walk with the source in it. */
@@ -1388,12 +1388,13 @@ function settleTier(tier, fps, failed) {
1388
1388
 
1389
1389
  // src/stage/PaperStage.tsx
1390
1390
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1391
- var BANNER = {
1391
+ var stageBanner = {
1392
1392
  sheet: { width: 1.5, height: 8.5, segments: "auto" },
1393
1393
  stock: "vellum",
1394
1394
  surface: { grain: 0.22 },
1395
1395
  deformers: [{ type: "drape", options: { amplitude: 0.16, folds: 3, falloff: 1.7, gather: 0.28 } }]
1396
1396
  };
1397
+ var BANNER = stageBanner;
1397
1398
  function splitAcrossBanners(text, banners) {
1398
1399
  const words = text.split(/\s+/).filter(Boolean);
1399
1400
  if (words.length === 0 || banners <= 0) return [];
@@ -2051,6 +2052,8 @@ function describeStage(input) {
2051
2052
  parts.push(`${count} tall paper banners standing along ${shape}`);
2052
2053
  if (input.text?.trim()) {
2053
2054
  parts.push("each printed with a column of your text running down it");
2055
+ } else if (input.images?.length) {
2056
+ parts.push(`each printed with one of ${input.images.length} pictures`);
2054
2057
  }
2055
2058
  parts.push(`seen ${SHOT_PHRASES[stage.shot.shot]}`);
2056
2059
  if (stage.showFigure) {
@@ -2067,10 +2070,20 @@ function describeStage(input) {
2067
2070
  if (input.scroll) parts.push("and scrolling the page walks the figure deeper into it");
2068
2071
  return parts.join(", ");
2069
2072
  }
2073
+ function exportableImages(images) {
2074
+ let substituted = false;
2075
+ const list = images.map((src, i) => {
2076
+ if (!src.startsWith("data:")) return src;
2077
+ substituted = true;
2078
+ return `/banner-${i + 1}.jpg`;
2079
+ });
2080
+ return { list, substituted };
2081
+ }
2070
2082
  function propLines(input, indent) {
2071
2083
  const lines = [];
2072
2084
  if (input.paper) lines.push(`${indent}preset={banner}`);
2073
2085
  if (input.text?.trim()) lines.push(`${indent}text={text}`);
2086
+ if (input.images?.length) lines.push(`${indent}images={images}`);
2074
2087
  if (input.count !== void 0) lines.push(`${indent}count={${input.count}}`);
2075
2088
  if (input.layout !== "colonnade") lines.push(`${indent}layout="${input.layout}"`);
2076
2089
  const layoutOptions = input.layoutOptions ?? {};
@@ -2095,10 +2108,14 @@ const banner = ${stringifyStage(diffConfig(paperConfigSchema.parse(input.paper))
2095
2108
  const textConst = input.text?.trim() ? `
2096
2109
 
2097
2110
  const text = ${JSON.stringify(input.text)}` : "";
2111
+ const images = input.images?.length ? exportableImages(input.images) : null;
2112
+ const imagesConst = images ? `
2113
+ ${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." : ""}
2114
+ const images = ${JSON.stringify(images.list, null, 2)}` : "";
2098
2115
  if (!input.scroll) {
2099
2116
  return `import { PaperStage, type StageConfigInput } from 'paperlab/stage'${input.paper ? "\nimport type { PaperConfigInput } from 'paperlab'" : ""}
2100
2117
 
2101
- ${stageConst}${bannerConst}${textConst}
2118
+ ${stageConst}${bannerConst}${textConst}${imagesConst}
2102
2119
 
2103
2120
  export function ${name}() {
2104
2121
  return (
@@ -2111,7 +2128,7 @@ ${propLines(input, " ")}
2111
2128
  return `import { useEffect, useRef, useState } from 'react'
2112
2129
  import { PaperStage, type StageConfigInput } from 'paperlab/stage'${input.paper ? "\nimport type { PaperConfigInput } from 'paperlab'" : ""}
2113
2130
 
2114
- ${stageConst}${bannerConst}${textConst}
2131
+ ${stageConst}${bannerConst}${textConst}${imagesConst}
2115
2132
 
2116
2133
  export function ${name}() {
2117
2134
  const ref = useRef<HTMLDivElement>(null)
@@ -2199,6 +2216,7 @@ export {
2199
2216
  listStagePresets,
2200
2217
  qualityNames,
2201
2218
  shotNames,
2219
+ stageBanner,
2202
2220
  stagePresets,
2203
2221
  stageSchema,
2204
2222
  walkNames,