paperlab 0.3.1 → 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/README.md +16 -16
- package/dist/{chunk-XE4E43MD.js → chunk-6IADJZX5.js} +2424 -2242
- package/dist/chunk-6IADJZX5.js.map +1 -0
- package/dist/index.cjs +887 -843
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +450 -1934
- package/dist/index.d.ts +450 -1934
- package/dist/index.js +202 -429
- package/dist/index.js.map +1 -1
- package/dist/slots-CIo7FnlY.d.cts +13357 -0
- package/dist/slots-CIo7FnlY.d.ts +13357 -0
- package/dist/stage.cjs +2377 -2125
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +52 -204
- package/dist/stage.d.ts +52 -204
- package/dist/stage.js +29 -18
- package/dist/stage.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-XE4E43MD.js.map +0 -1
- package/dist/slots-DUMR64HB.d.cts +0 -6661
- package/dist/slots-DUMR64HB.d.ts +0 -6661
package/dist/stage.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
resolveLighting,
|
|
16
16
|
usePrefersReducedMotion,
|
|
17
17
|
walkPathSchema
|
|
18
|
-
} from "./chunk-
|
|
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
|
|
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)
|
|
@@ -2189,7 +2206,6 @@ required; the component needs no props.`;
|
|
|
2189
2206
|
export {
|
|
2190
2207
|
PaperStage,
|
|
2191
2208
|
PaperStageScene,
|
|
2192
|
-
SOURCE_INTENSITY,
|
|
2193
2209
|
buildStageAgentPayload,
|
|
2194
2210
|
buildStageComponentSource,
|
|
2195
2211
|
createWalkPath,
|
|
@@ -2200,14 +2216,9 @@ export {
|
|
|
2200
2216
|
listStagePresets,
|
|
2201
2217
|
qualityNames,
|
|
2202
2218
|
shotNames,
|
|
2203
|
-
|
|
2204
|
-
stageMotionSchema,
|
|
2219
|
+
stageBanner,
|
|
2205
2220
|
stagePresets,
|
|
2206
|
-
stageRoomSchema,
|
|
2207
2221
|
stageSchema,
|
|
2208
|
-
stageSuspensionSchema,
|
|
2209
|
-
stringifyStage,
|
|
2210
|
-
walkNameFor,
|
|
2211
2222
|
walkNames,
|
|
2212
2223
|
walks
|
|
2213
2224
|
};
|