scrollcraft 2.0.7 → 2.0.8

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 CHANGED
@@ -14,20 +14,44 @@ npm install scrollcraft
14
14
 
15
15
  ---
16
16
 
17
- ## Quick Start
17
+ ## The Universal Asset Pipeline
18
18
 
19
- Initialize your project:
19
+ ScrollCraft features a **Universal Asset Pipeline** that runs identical logic in both the **CLI** (Node.js) and the **Browser** (ideal for CMS integrations like WordPress).
20
+
21
+ ### 1. CLI Usage (Node.js)
22
+ Transform your video into a ScrollCraft project from your terminal:
20
23
 
21
24
  ```bash
22
- # 1. Transform your video into a ScrollCraft project
23
- # This will extract frames, track the subject, and generate optimized variants and depth maps using cloud AI processing.
25
+ # This will extract frames, track the subject, and generate optimized variants and depth maps.
24
26
  npx scft create "your-video.mp4" --name "my-project" --track "apple" --cloud --depth
25
27
  ```
26
28
 
29
+ ### 2. Programmatic Usage (Browser/Node)
30
+ You can also import the pipeline into your own React apps or dashboard:
31
+
32
+ ```javascript
33
+ import { AssetPipeline } from 'scrollcraft/pipeline';
34
+
35
+ const pipeline = new AssetPipeline({
36
+ apiKey: process.env.FAL_KEY,
37
+ onProgress: (p) => console.log(`${p.step}: ${p.percent}%`)
38
+ });
39
+
40
+ // Returns the project configuration or a ZIP blob
41
+ const project = await pipeline.create({
42
+ input: videoFile, // Can be a File object or Path
43
+ name: "my-project",
44
+ variants: [720, 1080],
45
+ outputZip: true // Perfect for CMS uploads
46
+ });
47
+ ```
48
+
49
+ ---
50
+
27
51
  ```tsx
28
52
  // 2. Drop it into your Next.js app
29
53
  import project from './my-project/scrollcraft.json';
30
- import { ScrollCraftProvider, ScrollCraftCanvas, SubjectLayer } from 'scrollcraft';
54
+ import { ScrollCraftProvider, ScrollCraftCanvas, SubjectLayer } from 'scrollcraft/react';
31
55
 
32
56
  const App = () => (
33
57
  <ScrollCraftProvider
@@ -53,13 +77,13 @@ const App = () => (
53
77
  Choose your path based on your role:
54
78
 
55
79
  ### 👤 For Humans
56
- - [**Core Architecture**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/docs/architecture/page.md): Understand the state-snapshot engine.
57
- - [**Asset Pipeline**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/docs/asset-pipeline/page.md): Learn how to use the CLI and AI tracking.
58
- - [**React Hooks**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/docs/react-integration/page.md): Build custom interactive components.
80
+ - [**Core Architecture**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/architecture/page.md): Understand the state-snapshot engine.
81
+ - [**Asset Pipeline**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/asset-pipeline/page.md): Learn how to use the CLI and AI tracking.
82
+ - [**React Hooks**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/react-integration/page.md): Build custom interactive components.
59
83
 
60
84
  ### 🤖 For AI Agents
61
85
  - [**AGENTS.md**](https://github.com/aleskozelsky/scrollcraft/blob/main/AGENTS.md): Technical standard operating procedures for the repository.
62
- - [**AI Integration Protocol**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/docs/ai-integration/page.md): How to prompt agents to build scenes for you.
86
+ - [**AI Integration Protocol**](https://github.com/aleskozelsky/scrollcraft/blob/main/packages/docs/app/ai-integration/page.md): How to prompt agents to build scenes for you.
63
87
 
64
88
  ---
65
89
 
package/dist/cli/index.js CHANGED
@@ -232,8 +232,10 @@ program
232
232
  const config = await fs.readJson(configPath);
233
233
  if (config.version !== pkg.version) {
234
234
  console.warn(chalk_1.default.yellow(`⚠️ Version Mismatch: Project is ${config.version}, CLI is ${pkg.version}`));
235
- // In a real implementation, we might offer to upgrade or handle incompatibilities
236
235
  }
237
- console.log(chalk_1.default.dim('Skeletal update implemented. Continuing in next iteration...'));
236
+ console.log(chalk_1.default.red('⚠️ UNDER CONSTRUCTION'));
237
+ console.log(chalk_1.default.yellow('The "update" command is currently being refactored for the Universal Pipeline.'));
238
+ console.log(chalk_1.default.dim('Please use "scft create" to regenerate your project for now.\n'));
239
+ process.exit(0);
238
240
  });
239
241
  program.parse(process.argv);
@@ -0,0 +1,31 @@
1
+ import { IPipelineDriver, VariantConfig } from './types';
2
+ export declare class BrowserDriver implements IPipelineDriver {
3
+ private files;
4
+ constructor();
5
+ readFile(path: string): Promise<Uint8Array>;
6
+ writeFile(path: string, data: Uint8Array | string): Promise<void>;
7
+ mkdir(path: string): Promise<void>;
8
+ exists(path: string): Promise<boolean>;
9
+ readdir(dirPath: string): Promise<string[]>;
10
+ remove(path: string): Promise<void>;
11
+ join(...parts: string[]): string;
12
+ resolve(...parts: string[]): string;
13
+ /**
14
+ * EXTRACT FRAMES (via ffmpeg.wasm)
15
+ * Note: Requires SharedArrayBuffer & specific Headers if using multithreading.
16
+ */
17
+ extractFrames(videoSource: string | File | Blob, outputDir: string, onProgress?: (percent: number) => void): Promise<void>;
18
+ /**
19
+ * PROCESS IMAGE (via Canvas API)
20
+ * High-performance resizing and cropping using the browser's hardware-accelerated Canvas.
21
+ */
22
+ processImage(input: Uint8Array | string, config: VariantConfig, options?: {
23
+ grayscale?: boolean;
24
+ blur?: number;
25
+ }): Promise<Uint8Array>;
26
+ /**
27
+ * ZIP PROJECT (via JSZip)
28
+ * Bundles all processed assets into a single file for upload or download.
29
+ */
30
+ zipProject(outDir: string): Promise<Uint8Array>;
31
+ }
@@ -0,0 +1,15 @@
1
+ import { IPipelineDriver } from './types';
2
+ import { SubjectFrameData } from '../core/types';
3
+ export interface FalOptions {
4
+ apiKey?: string;
5
+ proxyUrl?: string;
6
+ }
7
+ export declare class FalService {
8
+ private options;
9
+ constructor(options?: FalOptions);
10
+ private getAuthHeaders;
11
+ trackSubject(input: string | File | Blob, driver: IPipelineDriver, prompt?: string): Promise<SubjectFrameData[]>;
12
+ generateDepthMap(input: string | File | Blob, driver: IPipelineDriver): Promise<string>;
13
+ private uploadFile;
14
+ private mapBoxesToTrackingData;
15
+ }
@@ -0,0 +1,21 @@
1
+ import { PipelineOptions, CreateCommandOptions } from './types';
2
+ import { ProjectConfiguration, AssetVariant } from '../core/types';
3
+ export declare class AssetPipeline {
4
+ private driver;
5
+ private options;
6
+ private fal;
7
+ constructor(options?: PipelineOptions);
8
+ /**
9
+ * INITIALIZE DRIVER
10
+ * Detects environment and loads the appropriate driver dynamically.
11
+ */
12
+ init(): Promise<void>;
13
+ private report;
14
+ /**
15
+ * THE MAIN ORCHESTRATOR
16
+ */
17
+ create(opts: CreateCommandOptions): Promise<ProjectConfiguration | Uint8Array<ArrayBufferLike>>;
18
+ private normalizeVariants;
19
+ private processVariants;
20
+ saveConfig(variants: AssetVariant[], outDir: string): Promise<ProjectConfiguration>;
21
+ }
@@ -0,0 +1,18 @@
1
+ import { IPipelineDriver, VariantConfig } from './types';
2
+ export declare class NodeDriver implements IPipelineDriver {
3
+ private ffmpegPath;
4
+ constructor();
5
+ readFile(filePath: string): Promise<Uint8Array>;
6
+ writeFile(filePath: string, data: Uint8Array | string): Promise<void>;
7
+ mkdir(dirPath: string): Promise<void>;
8
+ exists(filePath: string): Promise<boolean>;
9
+ readdir(dirPath: string): Promise<string[]>;
10
+ remove(filePath: string): Promise<void>;
11
+ join(...parts: string[]): string;
12
+ resolve(...parts: string[]): string;
13
+ extractFrames(videoSource: string, outputDir: string, onProgress?: (percent: number) => void): Promise<void>;
14
+ processImage(input: Uint8Array | string, config: VariantConfig, options?: {
15
+ grayscale?: boolean;
16
+ blur?: number;
17
+ }): Promise<Uint8Array>;
18
+ }
@@ -0,0 +1,43 @@
1
+ export interface PipelineProgress {
2
+ percent: number;
3
+ message: string;
4
+ step: 'initializing' | 'extracting' | 'tracking' | 'depth' | 'processing' | 'saving';
5
+ }
6
+ export interface VariantConfig {
7
+ id: string;
8
+ width: number;
9
+ height: number;
10
+ media: string;
11
+ orientation: 'portrait' | 'landscape';
12
+ aspectRatio: string;
13
+ }
14
+ export interface IPipelineDriver {
15
+ readFile(path: string): Promise<Uint8Array>;
16
+ writeFile(path: string, data: Uint8Array | string): Promise<void>;
17
+ mkdir(path: string): Promise<void>;
18
+ exists(path: string): Promise<boolean>;
19
+ readdir(path: string): Promise<string[]>;
20
+ remove(path: string): Promise<void>;
21
+ join(...parts: string[]): string;
22
+ resolve(...parts: string[]): string;
23
+ extractFrames(videoSource: string | File | Blob, outputDir: string, onProgress?: (percent: number) => void): Promise<void>;
24
+ processImage(input: Uint8Array | string, config: VariantConfig, options: {
25
+ grayscale?: boolean;
26
+ blur?: number;
27
+ }): Promise<Uint8Array>;
28
+ zipProject?(outDir: string): Promise<Uint8Array>;
29
+ }
30
+ export interface PipelineOptions {
31
+ apiKey?: string;
32
+ proxyUrl?: string;
33
+ onProgress?: (progress: PipelineProgress) => void;
34
+ }
35
+ export interface CreateCommandOptions {
36
+ input: string | File | Blob;
37
+ name: string;
38
+ track?: string;
39
+ hasDepth?: boolean;
40
+ variants: number[] | VariantConfig[];
41
+ step?: number;
42
+ outputZip?: boolean;
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scrollcraft",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "ScrollCraft is a web-based tool for scroll-triggered animations.",
5
5
  "main": "dist/core/scrollcraft.umd.min.js",
6
6
  "module": "dist/core/scrollcraft.umd.min.js",
@@ -10,18 +10,16 @@
10
10
  "import": "./dist/core/scrollcraft.umd.min.js",
11
11
  "require": "./dist/core/scrollcraft.umd.min.js"
12
12
  },
13
- "./core": {
14
- "types": "./dist/core/index.d.ts",
15
- "import": "./dist/core/scrollcraft.umd.min.js",
16
- "require": "./dist/core/scrollcraft.umd.min.js"
17
- },
18
13
  "./react": {
19
14
  "types": "./dist/react/index.d.ts",
20
- "require": "./dist/react/index.js",
21
- "import": "./dist/react/index.js"
15
+ "import": "./dist/react/index.js",
16
+ "require": "./dist/react/index.js"
22
17
  },
23
- "./cli": "./dist/cli/index.js",
24
- "./pipeline": "./dist/pipeline/index.js"
18
+ "./pipeline": {
19
+ "types": "./dist/pipeline/index.d.ts",
20
+ "import": "./dist/pipeline/index.js",
21
+ "require": "./dist/pipeline/index.js"
22
+ }
25
23
  },
26
24
  "types": "dist/core/index.d.ts",
27
25
  "bin": {
@@ -32,15 +30,15 @@
32
30
  "README.md"
33
31
  ],
34
32
  "scripts": {
35
- "build": "npm run sync-readme && npm run build:js && npm run build:types && npm run build:cli",
33
+ "build": "npm run sync-readme && npm run build:web && npm run build:pipeline",
36
34
  "sync-readme": "node -e \"fs.copyFileSync('../../README.md', './README.md')\"",
37
- "build:js": "webpack --config webpack.config.js --mode production",
38
- "build:types": "tsc --project tsconfig.json --emitDeclarationOnly",
39
- "build:cli": "tsc --project tsconfig.cli.json && node scripts/make-executable.cjs",
40
- "dev": "concurrently -n JS,CLI,TYP -c \"blue,yellow,magenta\" \"npm:dev:js\" \"npm:dev:cli\" \"npm:dev:types\"",
41
- "dev:js": "webpack --config webpack.config.js --mode development --watch",
42
- "dev:cli": "tsc --project tsconfig.cli.json --watch --preserveWatchOutput",
43
- "dev:types": "tsc --project tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput"
35
+ "build:web": "webpack --config webpack.config.js --mode production && npm run build:types:web",
36
+ "build:types:web": "tsc --project tsconfig.json --emitDeclarationOnly",
37
+ "build:pipeline": "tsc --project tsconfig.node.json && node scripts/make-executable.cjs",
38
+ "prepublishOnly": "npm run build",
39
+ "dev": "concurrently -n WEB,NODE -c \"blue,yellow\" \"npm:dev:web\" \"npm:dev:node\"",
40
+ "dev:web": "webpack --config webpack.config.js --mode development --watch",
41
+ "dev:node": "tsc --project tsconfig.node.json --watch --preserveWatchOutput"
44
42
  },
45
43
  "peerDependencies": {
46
44
  "react": ">=16.8.0",