@sequenza/workbench 1.0.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/app/index.html ADDED
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>local</title>
8
+ <script type="module" crossorigin src="/assets/index-CdVswdI1.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-BbK7hGuP.css">
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ </body>
14
+ </html>
package/app/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "socket.io";
3
+ import chokidar from "chokidar";
4
+ import { readFileSync } from "fs";
5
+ import { join } from "path";
6
+ import { fileURLToPath } from "url";
7
+ import express from "express";
8
+
9
+ const command = process.argv[2];
10
+
11
+ if (command !== "dev") {
12
+ console.error(`Unknown command: ${command ?? "(none)"}`);
13
+ console.error("Usage: sequenza dev");
14
+ process.exit(1);
15
+ }
16
+
17
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
18
+ const distDir = join(__dirname, "..", "app");
19
+ const userCwd = process.cwd();
20
+
21
+ const UI_PORT = 3000;
22
+ const SOCKET_PORT = 3001;
23
+
24
+ const app = express();
25
+ app.use(express.static(distDir));
26
+
27
+ app.get("/{*path}", (_req, res) => res.sendFile(join(distDir, "index.html")));
28
+ app.listen(UI_PORT, () => {
29
+ console.log(`Editor: http://localhost:${UI_PORT}`);
30
+ });
31
+
32
+ const io = new Server(SOCKET_PORT, { cors: { origin: "*" } });
33
+ const fragMap = {};
34
+
35
+ const watcher = chokidar.watch(userCwd, {
36
+ ignored: [
37
+ /node_modules/,
38
+ (path, stats) => (stats?.isFile() ?? false) && !path.endsWith(".frag"),
39
+ ],
40
+ persistent: true,
41
+ });
42
+
43
+ watcher
44
+ .on("add", (path) => {
45
+ fragMap[path] = readFileSync(path, "utf-8");
46
+ io.emit("shaders-found", fragMap);
47
+ })
48
+ .on("change", (path) => {
49
+ fragMap[path] = readFileSync(path, "utf-8");
50
+ io.emit("shaders-found", fragMap);
51
+ })
52
+ .on("unlink", (path) => {
53
+ delete fragMap[path];
54
+ io.emit("shaders-found", fragMap);
55
+ });
56
+
57
+ io.on("connection", (socket) => {
58
+ socket.emit("shaders-found", fragMap);
59
+ });
60
+
61
+ console.log(`Watcher: watching ${userCwd} on :${SOCKET_PORT}`);
@@ -0,0 +1,146 @@
1
+ import { Connection } from '../../library/src/index.ts';
2
+ import { Context } from 'react';
3
+ import { Edge } from '@xyflow/react';
4
+ import { exportSequenzaPatch } from '../../library/src/index.ts';
5
+ import { extractFields } from '../../library/src/index.ts';
6
+ import { FC } from 'react';
7
+ import { Field } from '../../library/src/index.ts';
8
+ import { HandleProps } from '@xyflow/react';
9
+ import { JSX } from 'react/jsx-runtime';
10
+ import { Node as Node_2 } from '@xyflow/react';
11
+ import { NodeProps } from '@xyflow/react';
12
+ import { Patch } from '../../library/src/index.ts';
13
+ import { Patch as Patch_2 } from '../../../library/src/index.ts';
14
+ import { ReactNode } from 'react';
15
+ import { RefObject } from 'react';
16
+ import { Renderer } from '../../library/src/index.ts';
17
+ import { RendererComponent } from '../../library/src/index.ts';
18
+ import { Shader } from '../../library/src/index.ts';
19
+ import { Shader as Shader_2 } from '../../../library/src/index.ts';
20
+ import { TextureUniform } from '../../library/src/index.ts';
21
+ import { Uniforms } from '../../library/src/index.ts';
22
+ import { Uniforms as Uniforms_2 } from '../../../library/src/index.ts';
23
+
24
+ export declare function buildEditorState(patch: Patch, uniforms: Record<string, Uniforms>): EditorInitialState;
25
+
26
+ export { Connection }
27
+
28
+ export declare const CustomHandle: FC<HandleProps>;
29
+
30
+ export declare const Dialog: FC<DialogProps>;
31
+
32
+ declare interface DialogProps {
33
+ children?: ReactNode;
34
+ open: boolean;
35
+ className?: string;
36
+ handleOpenChange: (open: boolean) => void;
37
+ }
38
+
39
+ export declare const Editor: FC<EditorProps>;
40
+
41
+ export declare const EditorContext: Context<EditorContextType>;
42
+
43
+ declare interface EditorContextType {
44
+ currentTime: RefObject<number>;
45
+ mousePosition: RefObject<[number, number]>;
46
+ shaders: Shader_2[];
47
+ patches: Record<string, Patch_2>;
48
+ uniforms: RefObject<Record<string, Uniforms_2>>;
49
+ showStats: boolean;
50
+ openExportNodeId: string | null;
51
+ setOpenExportNodeId: (id: string | null) => void;
52
+ openPreviewNodeId: string | null;
53
+ setOpenPreviewNodeId: (id: string | null) => void;
54
+ handleUpdateUniforms: (shaderId: string, newUniforms: Uniforms_2) => void;
55
+ handleUpdateNode: (nodeId: string, data: (snapshot: ShaderNodeData) => ShaderNodeData) => void;
56
+ handleInsertShader: (shader: Shader_2, edgeId: string) => void;
57
+ }
58
+
59
+ export declare type EditorInitialState = {
60
+ nodes: Node_2[];
61
+ edges: Edge[];
62
+ uniforms: Record<string, Uniforms>;
63
+ };
64
+
65
+ declare interface EditorProps {
66
+ shaders: Shader_2[];
67
+ initialState?: {
68
+ nodes: Node_2[];
69
+ edges: Edge[];
70
+ uniforms: Record<string, Uniforms_2>;
71
+ };
72
+ handleSave: (data: {
73
+ nodes: Node_2[];
74
+ edges: Edge[];
75
+ uniforms: Record<string, Uniforms_2>;
76
+ }) => void;
77
+ className?: string;
78
+ initialShowStats?: boolean;
79
+ initialShaderPanelOpen?: boolean;
80
+ initialOpenPreviewNodeId?: string | null;
81
+ onEditorStateChange?: (state: {
82
+ showStats: boolean;
83
+ shaderPanelOpen: boolean;
84
+ }) => void;
85
+ onOpenPreviewNodeIdChange?: (nodeId: string | null) => void;
86
+ }
87
+
88
+ export declare const ExportDialog: FC<ExportDialogProps>;
89
+
90
+ declare interface ExportDialogProps {
91
+ uniforms: Record<string, Uniforms_2>;
92
+ patch: Patch_2;
93
+ open: boolean;
94
+ onOpenChange: (open: boolean) => void;
95
+ }
96
+
97
+ export { exportSequenzaPatch }
98
+
99
+ export { extractFields }
100
+
101
+ export { Field }
102
+
103
+ export { Patch }
104
+
105
+ export { Renderer }
106
+
107
+ export { RendererComponent }
108
+
109
+ export declare const Scrubber: FC<ScrubberProps>;
110
+
111
+ declare interface ScrubberProps {
112
+ value: number;
113
+ min?: number;
114
+ max?: number;
115
+ step?: number;
116
+ label?: string;
117
+ onChange: (value: number) => void;
118
+ }
119
+
120
+ export { Shader }
121
+
122
+ export declare type ShaderNode = Node_2<ShaderNodeData, "shader">;
123
+
124
+ export declare const ShaderNode: ({ data, selected, id }: NodeProps<ShaderNode>) => JSX.Element | null;
125
+
126
+ declare type ShaderNodeData = {
127
+ shader: Shader_2;
128
+ paused: boolean;
129
+ uniforms: RefObject<Record<string, Uniforms_2>>;
130
+ };
131
+
132
+ export declare const staticShaders: Record<string, string>;
133
+
134
+ export { TextureUniform }
135
+
136
+ export declare const UniformForm: FC<UniformFormProps>;
137
+
138
+ declare interface UniformFormProps {
139
+ shader: Shader_2;
140
+ initialUniforms?: Uniforms_2;
141
+ handleUpdateUniform: (uniforms: Uniforms_2) => void;
142
+ }
143
+
144
+ export { Uniforms }
145
+
146
+ export { }
@@ -0,0 +1 @@
1
+ .image-crisp{image-rendering:crisp-edges;image-rendering:pixelated}