egaki 0.6.0 → 0.7.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/CHANGELOG.md +140 -9
- package/dist/cli/cache-utils.d.ts +33 -0
- package/dist/cli/cache-utils.d.ts.map +1 -0
- package/dist/cli/cache-utils.js +157 -0
- package/dist/cli/cached-generate.d.ts +105 -0
- package/dist/cli/cached-generate.d.ts.map +1 -0
- package/dist/cli/cached-generate.js +208 -0
- package/dist/cli/cached-generate.test.d.ts +11 -0
- package/dist/cli/cached-generate.test.d.ts.map +1 -0
- package/dist/cli/cached-generate.test.js +431 -0
- package/dist/cli/cartesia-provider.d.ts +16 -0
- package/dist/cli/cartesia-provider.d.ts.map +1 -0
- package/dist/cli/cartesia-provider.js +184 -0
- package/dist/cli/chatgpt-auth.d.ts.map +1 -0
- package/dist/cli/cli.d.ts +4 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/{cli.js → cli/cli.js} +626 -600
- package/dist/cli/clone-generate.d.ts +26 -0
- package/dist/cli/clone-generate.d.ts.map +1 -0
- package/dist/cli/clone-generate.js +148 -0
- package/dist/cli/credentials.d.ts.map +1 -0
- package/dist/{credentials.js → cli/credentials.js} +20 -0
- package/dist/cli/elevenlabs-speech-provider.d.ts +26 -0
- package/dist/cli/elevenlabs-speech-provider.d.ts.map +1 -0
- package/dist/cli/elevenlabs-speech-provider.js +199 -0
- package/dist/cli/generate.d.ts +140 -0
- package/dist/cli/generate.d.ts.map +1 -0
- package/dist/cli/generate.js +604 -0
- package/dist/cli/generate.test.d.ts +2 -0
- package/dist/cli/generate.test.d.ts.map +1 -0
- package/dist/cli/generate.test.js +131 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +7 -0
- package/dist/{model-catalog.d.ts → cli/model-catalog.d.ts} +6 -0
- package/dist/cli/model-catalog.d.ts.map +1 -0
- package/dist/{model-catalog.js → cli/model-catalog.js} +714 -4
- package/dist/{models.d.ts → cli/models.d.ts} +12 -5
- package/dist/cli/models.d.ts.map +1 -0
- package/dist/{models.js → cli/models.js} +58 -57
- package/dist/cli/open-browser.d.ts.map +1 -0
- package/dist/cli/openai-speech-provider.d.ts +3 -0
- package/dist/cli/openai-speech-provider.d.ts.map +1 -0
- package/dist/cli/openai-speech-provider.js +28 -0
- package/dist/cli/separation-generate.d.ts +34 -0
- package/dist/cli/separation-generate.d.ts.map +1 -0
- package/dist/cli/separation-generate.js +117 -0
- package/dist/cli/speech-catalog.d.ts +35 -0
- package/dist/cli/speech-catalog.d.ts.map +1 -0
- package/dist/cli/speech-catalog.js +195 -0
- package/dist/cli/speech-generate.d.ts +86 -0
- package/dist/cli/speech-generate.d.ts.map +1 -0
- package/dist/cli/speech-generate.js +156 -0
- package/dist/cli/speech-models.d.ts +8 -0
- package/dist/cli/speech-models.d.ts.map +1 -0
- package/dist/cli/speech-models.js +109 -0
- package/dist/cli/speech-provider.test.d.ts +2 -0
- package/dist/cli/speech-provider.test.d.ts.map +1 -0
- package/dist/cli/speech-provider.test.js +197 -0
- package/dist/cli/subscription.d.ts.map +1 -0
- package/dist/cli/transcription-catalog.d.ts +35 -0
- package/dist/cli/transcription-catalog.d.ts.map +1 -0
- package/dist/cli/transcription-catalog.js +192 -0
- package/dist/cli/transcription-generate.d.ts +62 -0
- package/dist/cli/transcription-generate.d.ts.map +1 -0
- package/dist/cli/transcription-generate.js +144 -0
- package/dist/cli/transcription-models.d.ts +9 -0
- package/dist/cli/transcription-models.d.ts.map +1 -0
- package/dist/cli/transcription-models.js +100 -0
- package/dist/cli/transcription-providers.d.ts +22 -0
- package/dist/cli/transcription-providers.d.ts.map +1 -0
- package/dist/cli/transcription-providers.js +290 -0
- package/dist/cli/video-model-catalog.d.ts.map +1 -0
- package/dist/cli/xai-auth.d.ts.map +1 -0
- package/dist/{xai-auth.js → cli/xai-auth.js} +1 -1
- package/dist/vite/angled-screen.d.ts +57 -0
- package/dist/vite/angled-screen.d.ts.map +1 -0
- package/dist/vite/angled-screen.js +115 -0
- package/dist/vite/app.d.ts +51 -0
- package/dist/vite/app.d.ts.map +1 -0
- package/dist/vite/app.js +150 -0
- package/dist/vite/bands-shader.d.ts +47 -0
- package/dist/vite/bands-shader.d.ts.map +1 -0
- package/dist/vite/bands-shader.js +267 -0
- package/dist/vite/code-block.d.ts +107 -0
- package/dist/vite/code-block.d.ts.map +1 -0
- package/dist/vite/code-block.js +641 -0
- package/dist/vite/components.d.ts +36 -0
- package/dist/vite/components.d.ts.map +1 -0
- package/dist/vite/components.js +113 -0
- package/dist/vite/dispersion-rings-shader.d.ts +44 -0
- package/dist/vite/dispersion-rings-shader.d.ts.map +1 -0
- package/dist/vite/dispersion-rings-shader.js +282 -0
- package/dist/vite/easing-curves.d.ts +129 -0
- package/dist/vite/easing-curves.d.ts.map +1 -0
- package/dist/vite/easing-curves.js +584 -0
- package/dist/vite/easing-curves.test.d.ts +2 -0
- package/dist/vite/easing-curves.test.d.ts.map +1 -0
- package/dist/vite/easing-curves.test.js +200 -0
- package/dist/vite/generated-media-client.d.ts +35 -0
- package/dist/vite/generated-media-client.d.ts.map +1 -0
- package/dist/vite/generated-media-client.js +76 -0
- package/dist/vite/keyframes.d.ts +129 -0
- package/dist/vite/keyframes.d.ts.map +1 -0
- package/dist/vite/keyframes.js +194 -0
- package/dist/vite/layout-editor.d.ts +45 -0
- package/dist/vite/layout-editor.d.ts.map +1 -0
- package/dist/vite/layout-editor.js +587 -0
- package/dist/vite/layout-transition.d.ts +136 -0
- package/dist/vite/layout-transition.d.ts.map +1 -0
- package/dist/vite/layout-transition.js +581 -0
- package/dist/vite/liquid-gradient-shader.d.ts +62 -0
- package/dist/vite/liquid-gradient-shader.d.ts.map +1 -0
- package/dist/vite/liquid-gradient-shader.js +413 -0
- package/dist/vite/mdx-client.d.ts +15 -0
- package/dist/vite/mdx-client.d.ts.map +1 -0
- package/dist/vite/mdx-client.js +265 -0
- package/dist/vite/mdx-parse.d.ts +102 -0
- package/dist/vite/mdx-parse.d.ts.map +1 -0
- package/dist/vite/mdx-parse.js +251 -0
- package/dist/vite/mdx-provided-components.d.ts +18 -0
- package/dist/vite/mdx-provided-components.d.ts.map +1 -0
- package/dist/vite/mdx-provided-components.js +14 -0
- package/dist/vite/mdx-video.d.ts +327 -0
- package/dist/vite/mdx-video.d.ts.map +1 -0
- package/dist/vite/mdx-video.js +596 -0
- package/dist/vite/mdx-video.test.d.ts +9 -0
- package/dist/vite/mdx-video.test.d.ts.map +1 -0
- package/dist/vite/mdx-video.test.js +1945 -0
- package/dist/vite/media-components.d.ts +45 -0
- package/dist/vite/media-components.d.ts.map +1 -0
- package/dist/vite/media-components.js +355 -0
- package/dist/vite/media-duration-store.d.ts +66 -0
- package/dist/vite/media-duration-store.d.ts.map +1 -0
- package/dist/vite/media-duration-store.js +204 -0
- package/dist/vite/player-page.d.ts +35 -0
- package/dist/vite/player-page.d.ts.map +1 -0
- package/dist/vite/player-page.js +720 -0
- package/dist/vite/render-client.d.ts +18 -0
- package/dist/vite/render-client.d.ts.map +1 -0
- package/dist/vite/render-client.js +67 -0
- package/dist/vite/sdk.d.ts +221 -0
- package/dist/vite/sdk.d.ts.map +1 -0
- package/dist/vite/sdk.js +355 -0
- package/dist/vite/server-components.d.ts +55 -0
- package/dist/vite/server-components.d.ts.map +1 -0
- package/dist/vite/server-components.js +156 -0
- package/dist/vite/server-mdx.d.ts +74 -0
- package/dist/vite/server-mdx.d.ts.map +1 -0
- package/dist/vite/server-mdx.js +259 -0
- package/dist/vite/shader-renderer.d.ts +48 -0
- package/dist/vite/shader-renderer.d.ts.map +1 -0
- package/dist/vite/shader-renderer.js +411 -0
- package/dist/vite/store-hooks.d.ts +12 -0
- package/dist/vite/store-hooks.d.ts.map +1 -0
- package/dist/vite/store-hooks.js +93 -0
- package/dist/vite/store.d.ts +75 -0
- package/dist/vite/store.d.ts.map +1 -0
- package/dist/vite/store.js +52 -0
- package/dist/vite/store.test.d.ts +6 -0
- package/dist/vite/store.test.d.ts.map +1 -0
- package/dist/vite/store.test.js +172 -0
- package/dist/vite/tweakpane-hook.d.ts +94 -0
- package/dist/vite/tweakpane-hook.d.ts.map +1 -0
- package/dist/vite/tweakpane-hook.js +450 -0
- package/dist/vite/vite-plugin.d.ts +28 -0
- package/dist/vite/vite-plugin.d.ts.map +1 -0
- package/dist/vite/vite-plugin.js +538 -0
- package/dist/vite/wave-gradient-shader.d.ts +41 -0
- package/dist/vite/wave-gradient-shader.d.ts.map +1 -0
- package/dist/vite/wave-gradient-shader.js +207 -0
- package/package.json +101 -24
- package/skills/egaki/SKILL.md +162 -1
- package/src/cli/cache-utils.ts +169 -0
- package/src/cli/cached-generate.test.ts +531 -0
- package/src/cli/cached-generate.ts +348 -0
- package/src/cli/cartesia-provider.ts +249 -0
- package/src/{cli.ts → cli/cli.ts} +836 -884
- package/src/cli/clone-generate.ts +202 -0
- package/src/{credentials.ts → cli/credentials.ts} +20 -0
- package/src/cli/elevenlabs-speech-provider.ts +243 -0
- package/src/cli/generate.test.ts +166 -0
- package/src/cli/generate.ts +912 -0
- package/src/cli/main.ts +8 -0
- package/src/{model-catalog.ts → cli/model-catalog.ts} +787 -58
- package/src/{models.ts → cli/models.ts} +65 -86
- package/src/cli/openai-speech-provider.ts +34 -0
- package/src/cli/separation-generate.ts +187 -0
- package/src/cli/speech-catalog.ts +253 -0
- package/src/cli/speech-generate.ts +275 -0
- package/src/cli/speech-models.ts +146 -0
- package/src/cli/speech-provider.test.ts +226 -0
- package/src/cli/transcription-catalog.ts +250 -0
- package/src/cli/transcription-generate.ts +214 -0
- package/src/cli/transcription-models.ts +136 -0
- package/src/cli/transcription-providers.ts +427 -0
- package/src/{xai-auth.ts → cli/xai-auth.ts} +1 -1
- package/src/vite/angled-screen.tsx +214 -0
- package/src/vite/app.tsx +197 -0
- package/src/vite/bands-shader.tsx +319 -0
- package/src/vite/code-block.tsx +939 -0
- package/src/vite/components.tsx +278 -0
- package/src/vite/dispersion-rings-shader.tsx +331 -0
- package/src/vite/easing-curves.test.ts +232 -0
- package/src/vite/easing-curves.ts +743 -0
- package/src/vite/generated-media-client.tsx +121 -0
- package/src/vite/keyframes.tsx +347 -0
- package/src/vite/layout-editor.tsx +709 -0
- package/src/vite/layout-transition.tsx +706 -0
- package/src/vite/liquid-gradient-shader.tsx +474 -0
- package/src/vite/mdx-client.tsx +420 -0
- package/src/vite/mdx-parse.ts +343 -0
- package/src/vite/mdx-provided-components.ts +19 -0
- package/src/vite/mdx-video.test.tsx +2219 -0
- package/src/vite/mdx-video.tsx +976 -0
- package/src/vite/media-components.tsx +473 -0
- package/src/vite/media-duration-store.ts +225 -0
- package/src/vite/motion-timing.ts +194 -0
- package/src/vite/player-page.tsx +1107 -0
- package/src/vite/render-client.ts +84 -0
- package/src/vite/sdk.ts +598 -0
- package/src/vite/server-components.tsx +241 -0
- package/src/vite/server-mdx.ts +285 -0
- package/src/vite/shader-renderer.tsx +535 -0
- package/src/vite/store-hooks.ts +117 -0
- package/src/vite/store.test.ts +202 -0
- package/src/vite/store.ts +115 -0
- package/src/vite/styles.css +21 -0
- package/src/vite/tweakpane-hook.tsx +593 -0
- package/src/vite/virtual-modules.d.ts +30 -0
- package/src/vite/vite-plugin.ts +584 -0
- package/src/vite/wave-gradient-shader.tsx +253 -0
- package/README.md +0 -370
- package/dist/antigravity-auth.d.ts +0 -15
- package/dist/antigravity-auth.d.ts.map +0 -1
- package/dist/antigravity-auth.js +0 -544
- package/dist/antigravity-image.d.ts +0 -11
- package/dist/antigravity-image.d.ts.map +0 -1
- package/dist/antigravity-image.js +0 -285
- package/dist/chatgpt-auth.d.ts.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/credentials.d.ts.map +0 -1
- package/dist/gateway-model-candidates.generated.d.ts +0 -11
- package/dist/gateway-model-candidates.generated.d.ts.map +0 -1
- package/dist/gateway-model-candidates.generated.js +0 -64
- package/dist/login.d.ts.map +0 -1
- package/dist/model-catalog.d.ts.map +0 -1
- package/dist/models.d.ts.map +0 -1
- package/dist/open-browser.d.ts.map +0 -1
- package/dist/subscription.d.ts.map +0 -1
- package/dist/video-model-catalog.d.ts.map +0 -1
- package/dist/xai-auth.d.ts.map +0 -1
- /package/dist/{chatgpt-auth.d.ts → cli/chatgpt-auth.d.ts} +0 -0
- /package/dist/{chatgpt-auth.js → cli/chatgpt-auth.js} +0 -0
- /package/dist/{credentials.d.ts → cli/credentials.d.ts} +0 -0
- /package/dist/{login.d.ts → cli/login.d.ts} +0 -0
- /package/dist/{login.js → cli/login.js} +0 -0
- /package/dist/{open-browser.d.ts → cli/open-browser.d.ts} +0 -0
- /package/dist/{open-browser.js → cli/open-browser.js} +0 -0
- /package/dist/{subscription.d.ts → cli/subscription.d.ts} +0 -0
- /package/dist/{subscription.js → cli/subscription.js} +0 -0
- /package/dist/{video-model-catalog.d.ts → cli/video-model-catalog.d.ts} +0 -0
- /package/dist/{video-model-catalog.js → cli/video-model-catalog.js} +0 -0
- /package/dist/{xai-auth.d.ts → cli/xai-auth.d.ts} +0 -0
- /package/src/{chatgpt-auth.ts → cli/chatgpt-auth.ts} +0 -0
- /package/src/{login.ts → cli/login.ts} +0 -0
- /package/src/{open-browser.ts → cli/open-browser.ts} +0 -0
- /package/src/{subscription.ts → cli/subscription.ts} +0 -0
- /package/src/{video-model-catalog.ts → cli/video-model-catalog.ts} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spiceflow entry for the video framework.
|
|
3
|
+
*
|
|
4
|
+
* The server has two jobs:
|
|
5
|
+
*
|
|
6
|
+
* 1. Deliver the MDX source string to the client through the RSC flight
|
|
7
|
+
* payload. All regular MDX processing (parsing, section splitting,
|
|
8
|
+
* expression evaluation, safe-mdx rendering) happens in the browser
|
|
9
|
+
* inside MdxClientApp (mdx-client.tsx, 'use client'), so MDX expression
|
|
10
|
+
* props can be functions and user components don't need 'use client'.
|
|
11
|
+
*
|
|
12
|
+
* 2. Render <Server> slots. <Server> is a reserved MDX element marking a
|
|
13
|
+
* subtree as server components: its children are rendered HERE in the
|
|
14
|
+
* RSC environment (async allowed, promises stream through flight) and
|
|
15
|
+
* passed to the client as serverSlots keyed by the node's start
|
|
16
|
+
* position. The MDX string sent to the client has each <Server> block
|
|
17
|
+
* blanked to a self-closing marker with newline padding, so every
|
|
18
|
+
* position (slot keys, data-markdown-line, sourcemaps) stays aligned
|
|
19
|
+
* with the original file and the client never parses server-only
|
|
20
|
+
* content.
|
|
21
|
+
*
|
|
22
|
+
* NOTE: Relative imports MUST include file extensions (.tsx, .ts) for the
|
|
23
|
+
* RSC module runner to resolve them correctly within noExternal packages.
|
|
24
|
+
*/
|
|
25
|
+
import { Spiceflow } from 'spiceflow';
|
|
26
|
+
import { type GenerationProgressEvent } from '../cli/cached-generate.js';
|
|
27
|
+
export declare const app: Spiceflow<"", true, {
|
|
28
|
+
state: {};
|
|
29
|
+
}, {
|
|
30
|
+
type: {};
|
|
31
|
+
error: {};
|
|
32
|
+
}, {
|
|
33
|
+
schema: {};
|
|
34
|
+
macro: {};
|
|
35
|
+
macroFn: {};
|
|
36
|
+
loaderData: {};
|
|
37
|
+
}, {
|
|
38
|
+
api: {
|
|
39
|
+
"generation-progress": {
|
|
40
|
+
get: {
|
|
41
|
+
request: unknown;
|
|
42
|
+
params: {};
|
|
43
|
+
query: unknown;
|
|
44
|
+
response: {
|
|
45
|
+
200: AsyncGenerator<GenerationProgressEvent, any, any>;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}, "" | "/" | "/api/generation-progress", Record<"/api/generation-progress", unknown>>;
|
|
51
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/vite/app.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAqBrC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAA;AA+IlC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;sFAAa,CAAA"}
|
package/dist/vite/app.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Spiceflow entry for the video framework.
|
|
12
|
+
*
|
|
13
|
+
* The server has two jobs:
|
|
14
|
+
*
|
|
15
|
+
* 1. Deliver the MDX source string to the client through the RSC flight
|
|
16
|
+
* payload. All regular MDX processing (parsing, section splitting,
|
|
17
|
+
* expression evaluation, safe-mdx rendering) happens in the browser
|
|
18
|
+
* inside MdxClientApp (mdx-client.tsx, 'use client'), so MDX expression
|
|
19
|
+
* props can be functions and user components don't need 'use client'.
|
|
20
|
+
*
|
|
21
|
+
* 2. Render <Server> slots. <Server> is a reserved MDX element marking a
|
|
22
|
+
* subtree as server components: its children are rendered HERE in the
|
|
23
|
+
* RSC environment (async allowed, promises stream through flight) and
|
|
24
|
+
* passed to the client as serverSlots keyed by the node's start
|
|
25
|
+
* position. The MDX string sent to the client has each <Server> block
|
|
26
|
+
* blanked to a self-closing marker with newline padding, so every
|
|
27
|
+
* position (slot keys, data-markdown-line, sourcemaps) stays aligned
|
|
28
|
+
* with the original file and the client never parses server-only
|
|
29
|
+
* content.
|
|
30
|
+
*
|
|
31
|
+
* NOTE: Relative imports MUST include file extensions (.tsx, .ts) for the
|
|
32
|
+
* RSC module runner to resolve them correctly within noExternal packages.
|
|
33
|
+
*/
|
|
34
|
+
import path from 'node:path';
|
|
35
|
+
import { createRequire } from 'node:module';
|
|
36
|
+
import { Spiceflow } from 'spiceflow';
|
|
37
|
+
import { SafeMdxRenderer } from 'safe-mdx';
|
|
38
|
+
import { mdxParse } from 'safe-mdx/parse';
|
|
39
|
+
import { entries, entryPaths, defaultRoute, projectRoot, folderName } from 'virtual:egaki-mdx';
|
|
40
|
+
import { Head } from 'spiceflow/react';
|
|
41
|
+
import { findServerNodes, blankServerContents, collectServerImportSources, filterImportNodesToModules, wrapGenerateNodes, } from "./server-mdx.js";
|
|
42
|
+
import { parseFrontmatter, buildMdxScope } from "./mdx-parse.js";
|
|
43
|
+
import { MdxClientApp } from "./mdx-client.js";
|
|
44
|
+
import * as mdxVideoExports from "./mdx-video.js";
|
|
45
|
+
import { GeneratedImage, GeneratedVideo, GeneratedSpeech, } from "./server-components.js";
|
|
46
|
+
import { getGenerationProgress, onProgressChange, } from '../cli/cached-generate.js';
|
|
47
|
+
/** Dynamically import the modules referenced inside <Server> blocks. */
|
|
48
|
+
async function importServerModules(ast) {
|
|
49
|
+
const requireFromRoot = createRequire(path.join(projectRoot, 'package.json'));
|
|
50
|
+
const modules = {};
|
|
51
|
+
for (const source of collectServerImportSources(ast)) {
|
|
52
|
+
if (/\.mdx?$/.test(source)) {
|
|
53
|
+
console.warn(`[egaki] imported .mdx files inside <Server> are not supported yet: ${source}`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const isPathLike = source.startsWith('.') || source.startsWith('/');
|
|
58
|
+
const id = isPathLike
|
|
59
|
+
? path.resolve(projectRoot, source)
|
|
60
|
+
: requireFromRoot.resolve(source);
|
|
61
|
+
modules[source] = await import(__rewriteRelativeImportExtension(/* @vite-ignore */ id));
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
console.warn(`[egaki] failed to import <Server> module ${source}:`, e.message);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return modules;
|
|
68
|
+
}
|
|
69
|
+
/** Build the server components map from the mdx-video namespace import.
|
|
70
|
+
* mdx-video.tsx has 'use client', so each named export in the namespace
|
|
71
|
+
* is an individual client reference. */
|
|
72
|
+
const serverComponents = {
|
|
73
|
+
...mdxVideoExports,
|
|
74
|
+
GeneratedImage,
|
|
75
|
+
GeneratedVideo,
|
|
76
|
+
GeneratedSpeech,
|
|
77
|
+
};
|
|
78
|
+
/** All route paths available for navigation, sorted. */
|
|
79
|
+
const availableEntries = Object.keys(entries || {}).sort();
|
|
80
|
+
/** Render a single MDX entry as a page. Shared by all route handlers. */
|
|
81
|
+
async function renderMdxPage(routePath) {
|
|
82
|
+
const mdxSource = entries[routePath];
|
|
83
|
+
const currentEntryPath = entryPaths[routePath];
|
|
84
|
+
if (mdxSource == null || currentEntryPath == null)
|
|
85
|
+
return null;
|
|
86
|
+
const title = routePath
|
|
87
|
+
? `${routePath} · ${folderName} · egaki`
|
|
88
|
+
: `${folderName} · egaki`;
|
|
89
|
+
let ast;
|
|
90
|
+
try {
|
|
91
|
+
ast = mdxParse(mdxSource);
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
console.error('[egaki] MDX parse error (server):', e);
|
|
95
|
+
return _jsxs(_Fragment, { children: [_jsx(Head, { children: _jsx(Head.Title, { children: title }) }), _jsx(MdxClientApp, { mdx: mdxSource, serverSlots: {}, entryPath: currentEntryPath, availableEntries: availableEntries, currentRoute: routePath })] });
|
|
96
|
+
}
|
|
97
|
+
wrapGenerateNodes(ast);
|
|
98
|
+
const serverNodes = findServerNodes(ast);
|
|
99
|
+
if (serverNodes.length === 0) {
|
|
100
|
+
return _jsxs(_Fragment, { children: [_jsx(Head, { children: _jsx(Head.Title, { children: title }) }), _jsx(MdxClientApp, { mdx: mdxSource, serverSlots: {}, entryPath: currentEntryPath, availableEntries: availableEntries, currentRoute: routePath })] });
|
|
101
|
+
}
|
|
102
|
+
const eagerModules = await importServerModules(ast);
|
|
103
|
+
const importNodes = filterImportNodesToModules(ast.children.filter((node) => node.type === 'mdxjsEsm'), Object.keys(eagerModules));
|
|
104
|
+
const { fps, bpm } = parseFrontmatter(ast);
|
|
105
|
+
const serverScope = buildMdxScope(fps, bpm);
|
|
106
|
+
const serverEvaluateOptions = { functions: true };
|
|
107
|
+
const serverSlots = {};
|
|
108
|
+
for (const { key, node } of serverNodes) {
|
|
109
|
+
if (key in serverSlots) {
|
|
110
|
+
console.warn(`[egaki] multiple <Server> elements start on line ${key}; ` +
|
|
111
|
+
`only the first one renders. Put each <Server> on its own line.`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
serverSlots[key] = (_jsx(SafeMdxRenderer, { markdown: mdxSource, mdast: { type: 'root', children: [...importNodes, ...node.children] }, components: serverComponents, modules: eagerModules, baseUrl: "./", scope: serverScope, evaluateOptions: serverEvaluateOptions, onError: (e) => console.warn('[egaki] <Server> slot:', e.message) }));
|
|
115
|
+
}
|
|
116
|
+
const clientMdx = blankServerContents(mdxSource, serverNodes);
|
|
117
|
+
return _jsxs(_Fragment, { children: [_jsx(Head, { children: _jsx(Head.Title, { children: title }) }), _jsx(MdxClientApp, { mdx: clientMdx, serverSlots: serverSlots, entryPath: currentEntryPath, availableEntries: availableEntries, currentRoute: routePath })] });
|
|
118
|
+
}
|
|
119
|
+
// Build the Spiceflow app with explicit routes for each discovered entry.
|
|
120
|
+
// Using explicit routes instead of a wildcard (/*) avoids intercepting
|
|
121
|
+
// the /api/generation-progress GET endpoint. Spiceflow's .page() registers
|
|
122
|
+
// both GET and POST, so a wildcard would shadow the API route.
|
|
123
|
+
function buildApp() {
|
|
124
|
+
let app = new Spiceflow()
|
|
125
|
+
.get('/api/generation-progress', async function* () {
|
|
126
|
+
let resolve = null;
|
|
127
|
+
const unsubscribe = onProgressChange(() => resolve?.());
|
|
128
|
+
try {
|
|
129
|
+
while (true) {
|
|
130
|
+
const progress = getGenerationProgress();
|
|
131
|
+
yield progress;
|
|
132
|
+
if (progress.summary.total === 0)
|
|
133
|
+
return;
|
|
134
|
+
await new Promise((r) => { resolve = r; });
|
|
135
|
+
resolve = null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
unsubscribe();
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
.page('/', () => renderMdxPage(defaultRoute));
|
|
143
|
+
// Register each entry at its route path. The default also gets its
|
|
144
|
+
// own /<name> route so the dropdown can navigate to it from other pages.
|
|
145
|
+
for (const route of availableEntries) {
|
|
146
|
+
app = app.page(`/${route}`, () => renderMdxPage(route));
|
|
147
|
+
}
|
|
148
|
+
return app;
|
|
149
|
+
}
|
|
150
|
+
export const app = buildApp();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BandsShader — chromatic dispersion through repeating lens bands.
|
|
3
|
+
*
|
|
4
|
+
* Port of Framer's DispersionBands shader module for Remotion/egaki.
|
|
5
|
+
* Original source:
|
|
6
|
+
* https://framerusercontent.com/modules/jVqOzZrK81udrIw4uWLw/cV6qlarOv1tGcvTbyZeC/DispersionBands.js
|
|
7
|
+
*
|
|
8
|
+
* An animated gradient of user-defined colors is distorted through a tiled
|
|
9
|
+
* grid of spherical lenses. Each lens splits light into RGB channels at its
|
|
10
|
+
* edges (chromatic dispersion), producing rainbow fringing similar to light
|
|
11
|
+
* passing through a prism. 8-sample temporal anti-aliasing with per-sample
|
|
12
|
+
* spectral weighting gives the effect a soft, photographic quality.
|
|
13
|
+
*
|
|
14
|
+
* With the default lensSpacingY=0.01, lenses are essentially horizontal bands
|
|
15
|
+
* spanning full height. Increasing lensSpacingY creates a 2D grid of individual
|
|
16
|
+
* spherical lenses.
|
|
17
|
+
*/
|
|
18
|
+
import type { CSSProperties } from 'react';
|
|
19
|
+
export interface BandsShaderProps {
|
|
20
|
+
/** Color palette for the gradient (max 8). Hex strings like "#4AB7FF". */
|
|
21
|
+
colors?: string[];
|
|
22
|
+
/** Seed for gradient flow directions and frequencies. Different seeds = different patterns. */
|
|
23
|
+
seed?: number;
|
|
24
|
+
/** Animation speed multiplier. 0 = frozen, 0.3 = default, 2 = fast. */
|
|
25
|
+
speed?: number;
|
|
26
|
+
/** Wavy spatial jitter per sample. 0 = clean, higher = dreamy/melting distortion. */
|
|
27
|
+
ephemeralAmp?: number;
|
|
28
|
+
/** UV scale before the lens grid. Higher = more zoomed in, fewer visible lens cells. */
|
|
29
|
+
lensScale?: number;
|
|
30
|
+
/** Horizontal spacing of the repeating lens cells. Smaller = more lens columns. */
|
|
31
|
+
lensSpacingX?: number;
|
|
32
|
+
/** Vertical spacing of lens cells. At 0.01 (default) lenses are tall horizontal bands. */
|
|
33
|
+
lensSpacingY?: number;
|
|
34
|
+
/** Radius of each lens sphere. Controls magnification area vs flat area. */
|
|
35
|
+
lensRadius?: number;
|
|
36
|
+
/** How much R and B channels diverge from G at lens edges. 0 = none, 1 = maximum rainbow. */
|
|
37
|
+
dispersionStrength?: number;
|
|
38
|
+
/** Extra rainbow tint multiplier at lens edges. Pushes edge colors toward prismatic look. */
|
|
39
|
+
edgeDisp?: number;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Property controls matching the original Framer DispersionBands module.
|
|
44
|
+
* Ranges, defaults, and step sizes are preserved from the original.
|
|
45
|
+
*/
|
|
46
|
+
export declare const BandsShader: React.FC<BandsShaderProps>;
|
|
47
|
+
//# sourceMappingURL=bands-shader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bands-shader.d.ts","sourceRoot":"","sources":["../../src/vite/bands-shader.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAO1C,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6FAA6F;IAC7F,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AA6LD;;;GAGG;AACH,eAAO,MAAM,WAAW,EA4ElB,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { defineShader } from "./shader-renderer.js";
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Fragment shader body
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
/**
|
|
7
|
+
* Raw GLSL fragment body from DispersionBands.js.
|
|
8
|
+
* The defineShader engine prepends #version, precision, v_uv, fragColor,
|
|
9
|
+
* uniform declarations, and built-in uniforms automatically.
|
|
10
|
+
*
|
|
11
|
+
* Algorithm overview:
|
|
12
|
+
* 1. Gradient flow: seed-derived sin/cos waves create an organic color field
|
|
13
|
+
* 2. Band lens: UV is tiled into repeating cells; each cell has a spherical
|
|
14
|
+
* lens that warps UVs outward (magnification at center, edge factor at rim)
|
|
15
|
+
* 3. Chromatic dispersion: lens applied 3× per sample (R, G, B) with different
|
|
16
|
+
* index-of-refraction offsets, splitting color channels at lens edges
|
|
17
|
+
* 4. 8-sample TAA: per-pixel random offset + spectral tint weights, averaged
|
|
18
|
+
*/
|
|
19
|
+
const FRAGMENT_SOURCE = `
|
|
20
|
+
const int SAMPLES = 8;
|
|
21
|
+
const float EPHEMERAL_DRIP = 1.0;
|
|
22
|
+
|
|
23
|
+
// === PCG hash - https://www.jcgt.org/published/0009/03/02/
|
|
24
|
+
uvec3 hash3(uvec3 v) {
|
|
25
|
+
v = v * 1664525u + 1013904223u;
|
|
26
|
+
v.x += v.y * v.z;
|
|
27
|
+
v.y += v.z * v.x;
|
|
28
|
+
v.z += v.x * v.y;
|
|
29
|
+
v ^= v >> 16u;
|
|
30
|
+
v.x += v.y * v.z;
|
|
31
|
+
v.y += v.z * v.x;
|
|
32
|
+
v.z += v.x * v.y;
|
|
33
|
+
return v;
|
|
34
|
+
}
|
|
35
|
+
uvec3 seed;
|
|
36
|
+
vec3 random3f() {
|
|
37
|
+
seed = hash3(seed);
|
|
38
|
+
return vec3(seed) / float(-1u);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
vec3 seedRandom(float seedVal) {
|
|
42
|
+
uvec3 s = uvec3(
|
|
43
|
+
floatBitsToUint(seedVal),
|
|
44
|
+
floatBitsToUint(seedVal * 1.5 + 7.31),
|
|
45
|
+
floatBitsToUint(seedVal * 2.7 + 13.37)
|
|
46
|
+
);
|
|
47
|
+
s = hash3(s);
|
|
48
|
+
return vec3(s) / float(0xFFFFFFFFu);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// === PALETTE SAMPLING ===
|
|
52
|
+
vec3 getColor(int idx) {
|
|
53
|
+
if (u_colors_length < 1) return vec3(0.0);
|
|
54
|
+
int safeIdx = clamp(idx, 0, u_colors_length - 1);
|
|
55
|
+
return u_colors[safeIdx].rgb;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
vec3 paletteN(float t, int count) {
|
|
59
|
+
if (count < 1) return vec3(0.0);
|
|
60
|
+
if (count < 2) return getColor(0);
|
|
61
|
+
t = clamp(t, 0.0, 1.0) * float(count - 1);
|
|
62
|
+
int idx = min(int(floor(t)), count - 2);
|
|
63
|
+
float localT = fract(t);
|
|
64
|
+
localT = localT * localT * (3.0 - 2.0 * localT);
|
|
65
|
+
return mix(getColor(idx), getColor(idx + 1), localT);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// === Gradient Flow ===
|
|
69
|
+
float getGradientT(vec2 uv, float t, vec3 s1, vec3 s2) {
|
|
70
|
+
// Seed-derived flow directions
|
|
71
|
+
float angle1 = s1.x * 6.28;
|
|
72
|
+
float angle2 = s1.y * 6.28;
|
|
73
|
+
vec2 dir1 = vec2(cos(angle1), sin(angle1));
|
|
74
|
+
vec2 dir2 = vec2(cos(angle2), sin(angle2));
|
|
75
|
+
|
|
76
|
+
// Seed-derived frequencies
|
|
77
|
+
float freq1 = 1.0 + s1.z * 2.0;
|
|
78
|
+
float freq2 = 1.0 + s2.x * 1.5;
|
|
79
|
+
float freq3 = 1.5 + s2.y * 2.0;
|
|
80
|
+
|
|
81
|
+
float flow = dot(uv, dir1) + sin(dot(uv, dir2) * freq1 + t) * 0.3 + t * 0.2;
|
|
82
|
+
float flow2 = dot(uv, dir2.yx) + cos(dot(uv, dir1.yx) * freq2 - t * 0.8) * 0.25;
|
|
83
|
+
|
|
84
|
+
float gradT = sin(flow * 1.5) * 0.5 + 0.5;
|
|
85
|
+
gradT += cos(flow2 * 1.2) * 1.3;
|
|
86
|
+
gradT += sin(dot(uv, dir1 + dir2) * freq3 + t * 3.5) * 1.2;
|
|
87
|
+
|
|
88
|
+
return smoothstep(0.0, 4.12, gradT);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// === BAND LENS ===
|
|
92
|
+
void applyBandLens(vec2 pp, float radiusSq, float iorOffset, out vec2 warpedUV, out float edgeFactor) {
|
|
93
|
+
vec2 ppLens = pp;
|
|
94
|
+
float spacingX = max(u_lensSpacingX, 0.001);
|
|
95
|
+
float spacingY = max(u_lensSpacingY, 0.001);
|
|
96
|
+
ppLens.x = fract(pp.x / spacingX + 0.5) * spacingX - spacingX * 0.5;
|
|
97
|
+
ppLens.y = fract(pp.y / spacingY + 0.5) * spacingY - spacingY * 0.5;
|
|
98
|
+
|
|
99
|
+
float sp = radiusSq - ppLens.x * ppLens.x - ppLens.y * ppLens.y;
|
|
100
|
+
|
|
101
|
+
float lensAmount = smoothstep(-0.1, 0.05, sp);
|
|
102
|
+
float baseLens = sqrt(max(sp, -sp * 0.1) / 0.3);
|
|
103
|
+
edgeFactor = (1.0 - smoothstep(0.0, radiusSq, sp)) * lensAmount;
|
|
104
|
+
|
|
105
|
+
float warpAmount = mix(1.0, baseLens * (1.0 + iorOffset), lensAmount);
|
|
106
|
+
|
|
107
|
+
warpedUV = pp;
|
|
108
|
+
warpedUV.x += (ppLens.x * warpAmount - ppLens.x);
|
|
109
|
+
warpedUV.y *= warpAmount;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
void main() {
|
|
113
|
+
vec2 fragCoord = v_uv * u_resolution;
|
|
114
|
+
seed = uvec3(uvec2(fragCoord), uint(fract(u_time) * 1000.0));
|
|
115
|
+
|
|
116
|
+
vec2 r = u_resolution;
|
|
117
|
+
vec2 p = (fragCoord * 2.0 - r) / r.y;
|
|
118
|
+
float t = u_time * u_speed;
|
|
119
|
+
|
|
120
|
+
int colorCount = u_colors_length;
|
|
121
|
+
|
|
122
|
+
// Early out: no colors -> black
|
|
123
|
+
if (colorCount < 1) {
|
|
124
|
+
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Seed-based offsets for gradient flow
|
|
129
|
+
vec3 seedOff1 = seedRandom(u_seed);
|
|
130
|
+
vec3 seedOff2 = seedRandom(u_seed + 100.0);
|
|
131
|
+
|
|
132
|
+
float dice = random3f().x;
|
|
133
|
+
|
|
134
|
+
float radiusSq = u_lensRadius * u_lensRadius;
|
|
135
|
+
vec3 iorOffsets = vec3(-1.0, 0.0, 1.0) * u_dispersionStrength;
|
|
136
|
+
|
|
137
|
+
vec3 col = vec3(0.0);
|
|
138
|
+
|
|
139
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
140
|
+
float ephemeral = (float(i) + dice) / float(SAMPLES);
|
|
141
|
+
float sqEph = ephemeral * ephemeral;
|
|
142
|
+
|
|
143
|
+
vec2 pt = p;
|
|
144
|
+
pt.x += u_ephemeralAmp * sqEph * sin(p.y * 2.0 + t);
|
|
145
|
+
pt.y += u_ephemeralAmp * sqEph * cos(p.x * 1.5 - t) * 0.5;
|
|
146
|
+
pt.y -= (1.0 - exp(-EPHEMERAL_DRIP * sqEph)) * abs(pt.y) * sign(pt.y) * 0.3;
|
|
147
|
+
|
|
148
|
+
vec3 tint = smoothstep(1.0, 0.0, abs(3.0 * ephemeral - vec3(1.0, 1.5, 2.0)));
|
|
149
|
+
|
|
150
|
+
vec3 gradTs = vec3(0.0);
|
|
151
|
+
vec3 edgeFactors = vec3(0.0);
|
|
152
|
+
|
|
153
|
+
for (int c = 0; c < 3; c++) {
|
|
154
|
+
vec2 pp = pt * u_lensScale;
|
|
155
|
+
vec2 warpedUV;
|
|
156
|
+
float edgeFactor;
|
|
157
|
+
applyBandLens(pp, radiusSq, iorOffsets[c], warpedUV, edgeFactor);
|
|
158
|
+
|
|
159
|
+
vec2 gradUV = warpedUV / u_lensScale;
|
|
160
|
+
gradTs[c] = getGradientT(gradUV, t * 0.8, seedOff1, seedOff2);
|
|
161
|
+
edgeFactors[c] = edgeFactor;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
vec3 convergentColor = paletteN(gradTs.g, colorCount);
|
|
165
|
+
float edgeMix = max(max(edgeFactors.r, edgeFactors.g), edgeFactors.b);
|
|
166
|
+
|
|
167
|
+
vec3 dispersedColor = vec3(
|
|
168
|
+
paletteN(gradTs.r, colorCount).r,
|
|
169
|
+
convergentColor.g,
|
|
170
|
+
paletteN(gradTs.b, colorCount).b
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
vec3 finalColor = mix(convergentColor, dispersedColor, edgeMix * 2.0);
|
|
174
|
+
|
|
175
|
+
vec3 rainbow = (gradTs - gradTs.g) * 3.0;
|
|
176
|
+
finalColor += rainbow * edgeMix * u_edgeDisp;
|
|
177
|
+
|
|
178
|
+
col += tint * finalColor * (3.0 / float(SAMPLES));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
fragColor = vec4(col, 1.0);
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
// Component
|
|
186
|
+
// ---------------------------------------------------------------------------
|
|
187
|
+
/**
|
|
188
|
+
* Property controls matching the original Framer DispersionBands module.
|
|
189
|
+
* Ranges, defaults, and step sizes are preserved from the original.
|
|
190
|
+
*/
|
|
191
|
+
export const BandsShader = defineShader({
|
|
192
|
+
title: 'BandsShader',
|
|
193
|
+
fragment: FRAGMENT_SOURCE,
|
|
194
|
+
propertyControls: {
|
|
195
|
+
colors: {
|
|
196
|
+
type: 'array',
|
|
197
|
+
control: { type: 'color' },
|
|
198
|
+
maxCount: 8,
|
|
199
|
+
maxVisible: 4,
|
|
200
|
+
defaultValue: ['#4AB7FF', '#000000', '#FF4040'],
|
|
201
|
+
},
|
|
202
|
+
seed: {
|
|
203
|
+
type: 'number',
|
|
204
|
+
defaultValue: 210,
|
|
205
|
+
min: 0,
|
|
206
|
+
max: 1000,
|
|
207
|
+
step: 1,
|
|
208
|
+
},
|
|
209
|
+
speed: {
|
|
210
|
+
type: 'number',
|
|
211
|
+
defaultValue: 0.3,
|
|
212
|
+
min: 0,
|
|
213
|
+
max: 2,
|
|
214
|
+
step: 0.01,
|
|
215
|
+
},
|
|
216
|
+
ephemeralAmp: {
|
|
217
|
+
type: 'number',
|
|
218
|
+
defaultValue: 0,
|
|
219
|
+
min: 0,
|
|
220
|
+
max: 0.5,
|
|
221
|
+
step: 0.01,
|
|
222
|
+
},
|
|
223
|
+
lensScale: {
|
|
224
|
+
type: 'number',
|
|
225
|
+
defaultValue: 3.7,
|
|
226
|
+
min: 0.1,
|
|
227
|
+
max: 10,
|
|
228
|
+
step: 0.1,
|
|
229
|
+
},
|
|
230
|
+
lensSpacingX: {
|
|
231
|
+
type: 'number',
|
|
232
|
+
defaultValue: 1,
|
|
233
|
+
min: 0.01,
|
|
234
|
+
max: 5,
|
|
235
|
+
step: 0.01,
|
|
236
|
+
},
|
|
237
|
+
lensSpacingY: {
|
|
238
|
+
type: 'number',
|
|
239
|
+
defaultValue: 0.01,
|
|
240
|
+
min: 0.01,
|
|
241
|
+
max: 5,
|
|
242
|
+
step: 0.01,
|
|
243
|
+
hidden: true,
|
|
244
|
+
},
|
|
245
|
+
lensRadius: {
|
|
246
|
+
type: 'number',
|
|
247
|
+
defaultValue: 0.58,
|
|
248
|
+
min: 0.1,
|
|
249
|
+
max: 2,
|
|
250
|
+
step: 0.01,
|
|
251
|
+
},
|
|
252
|
+
dispersionStrength: {
|
|
253
|
+
type: 'number',
|
|
254
|
+
defaultValue: 0.4,
|
|
255
|
+
min: 0,
|
|
256
|
+
max: 1,
|
|
257
|
+
step: 0.01,
|
|
258
|
+
},
|
|
259
|
+
edgeDisp: {
|
|
260
|
+
type: 'number',
|
|
261
|
+
defaultValue: 2,
|
|
262
|
+
min: 0,
|
|
263
|
+
max: 5,
|
|
264
|
+
step: 0.1,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeBlock — ray.so-faithful syntax-highlighted code block for video.
|
|
3
|
+
*
|
|
4
|
+
* Uses shiki (TextMate grammars + WASM) for real syntax highlighting,
|
|
5
|
+
* with a CSS variables theme that maps token scopes to --ray-* vars.
|
|
6
|
+
* Theme colors are injected as inline CSS custom properties. The HTML
|
|
7
|
+
* from shiki's codeToHtml() is rendered via dangerouslySetInnerHTML.
|
|
8
|
+
*
|
|
9
|
+
* Per-theme frame styles are ported from ray.so's frame components:
|
|
10
|
+
* - Vercel: gridlines + corner brackets, no window chrome
|
|
11
|
+
* - Stripe: dashed gridlines + skewed stripe shape
|
|
12
|
+
* - OpenAI: clean rounded window, navy background
|
|
13
|
+
* - Supabase/Cloudflare: filename header, custom borders
|
|
14
|
+
* - Default: macOS traffic lights + title bar (non-partner themes)
|
|
15
|
+
*
|
|
16
|
+
* Source: https://github.com/raycast/ray-so
|
|
17
|
+
*
|
|
18
|
+
* Key source files:
|
|
19
|
+
* - Themes & syntax colors: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/store/themes.ts
|
|
20
|
+
* - CSS variables theme: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/util/theme-css-variables.ts
|
|
21
|
+
* - Shiki highlighter init: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/code.tsx
|
|
22
|
+
* - Highlighted code render: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/HighlightedCode.tsx
|
|
23
|
+
* - Editor + token CSS: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/Editor.module.css
|
|
24
|
+
* - Frame switch: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/Frame.tsx
|
|
25
|
+
* - Default frame: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/frames/DefaultFrame.tsx
|
|
26
|
+
* - Vercel frame: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/frames/VercelFrame.tsx
|
|
27
|
+
* - Stripe frame: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/frames/StripeFrame.tsx
|
|
28
|
+
* - OpenAI frame: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/frames/OpenAIFrame.tsx
|
|
29
|
+
* - Supabase frame: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/frames/SupabaseFrame.tsx
|
|
30
|
+
* - Cloudflare frame: https://github.com/raycast/ray-so/blob/main/app/(navigation)/(code)/components/frames/CloudflareFrame.tsx
|
|
31
|
+
*/
|
|
32
|
+
import { type ReactNode } from 'react';
|
|
33
|
+
export declare const CodeBlockContext: import("react").Context<boolean>;
|
|
34
|
+
type SyntaxColors = {
|
|
35
|
+
foreground: string;
|
|
36
|
+
constant?: string;
|
|
37
|
+
string?: string;
|
|
38
|
+
comment?: string;
|
|
39
|
+
keyword?: string;
|
|
40
|
+
parameter?: string;
|
|
41
|
+
function?: string;
|
|
42
|
+
stringExpression?: string;
|
|
43
|
+
punctuation?: string;
|
|
44
|
+
link?: string;
|
|
45
|
+
number?: string;
|
|
46
|
+
property?: string;
|
|
47
|
+
objectLiteral?: string;
|
|
48
|
+
highlight?: string;
|
|
49
|
+
highlightBorder?: string;
|
|
50
|
+
highlightHover?: string;
|
|
51
|
+
diffDeleted?: string;
|
|
52
|
+
diffInserted?: string;
|
|
53
|
+
};
|
|
54
|
+
type FrameType = 'default' | 'vercel' | 'stripe' | 'openai' | 'supabase' | 'cloudflare';
|
|
55
|
+
export type CodeBlockTheme = {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
background: {
|
|
59
|
+
from: string;
|
|
60
|
+
to: string;
|
|
61
|
+
};
|
|
62
|
+
frame: FrameType;
|
|
63
|
+
/** Decorative — the preferred font name from ray.so. Not used for rendering
|
|
64
|
+
* since web fonts aren't guaranteed; kept for documentation only. */
|
|
65
|
+
font?: string;
|
|
66
|
+
/** Per-frame visual overrides */
|
|
67
|
+
frameColors?: {
|
|
68
|
+
windowBg?: string;
|
|
69
|
+
windowBgLight?: string;
|
|
70
|
+
border?: string;
|
|
71
|
+
borderLight?: string;
|
|
72
|
+
headerBg?: string;
|
|
73
|
+
headerBgLight?: string;
|
|
74
|
+
gridline?: string;
|
|
75
|
+
gridlineLight?: string;
|
|
76
|
+
lineNumber?: string;
|
|
77
|
+
lineNumberLight?: string;
|
|
78
|
+
frameBg?: string;
|
|
79
|
+
frameBgLight?: string;
|
|
80
|
+
};
|
|
81
|
+
syntax: {
|
|
82
|
+
light?: SyntaxColors;
|
|
83
|
+
dark?: SyntaxColors;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export declare const CODE_THEMES: Record<string, CodeBlockTheme>;
|
|
87
|
+
export interface CodeBlockProps {
|
|
88
|
+
children?: ReactNode;
|
|
89
|
+
theme?: string;
|
|
90
|
+
darkMode?: boolean;
|
|
91
|
+
title?: string;
|
|
92
|
+
language?: string;
|
|
93
|
+
showLineNumbers?: boolean;
|
|
94
|
+
highlightLines?: number[];
|
|
95
|
+
padding?: number;
|
|
96
|
+
fontSize?: number;
|
|
97
|
+
width?: number | string;
|
|
98
|
+
height?: number | string;
|
|
99
|
+
showBackground?: boolean;
|
|
100
|
+
staggerFrames?: number;
|
|
101
|
+
}
|
|
102
|
+
export declare function CodeBlock({ children, theme: themeId, darkMode, title, language, showLineNumbers, highlightLines, padding, fontSize, width, height, showBackground, staggerFrames, }: CodeBlockProps): import("react").JSX.Element;
|
|
103
|
+
export declare function MdxCodeBlockWrapper({ children, ...rest }: {
|
|
104
|
+
children?: ReactNode;
|
|
105
|
+
} & Record<string, any>): import("react").JSX.Element;
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=code-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../src/vite/code-block.tsx"],"names":[],"mappings":"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"}
|