This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-unresolved */
|
||||
|
||||
import tryCatch from '@flowgram.ai/demo-fixed-layout-simple/src/data/tryCatch.ts?raw';
|
||||
import slot from '@flowgram.ai/demo-fixed-layout-simple/src/data/slot.ts?raw';
|
||||
import multiOutputs from '@flowgram.ai/demo-fixed-layout-simple/src/data/multiOutputs.ts?raw';
|
||||
import multiInputs from '@flowgram.ai/demo-fixed-layout-simple/src/data/multiInputs.ts?raw';
|
||||
import loop from '@flowgram.ai/demo-fixed-layout-simple/src/data/loop.ts?raw';
|
||||
import dynamicSplit from '@flowgram.ai/demo-fixed-layout-simple/src/data/dynamicSplit.ts?raw';
|
||||
|
||||
import { PreviewEditor } from '../preview-editor.tsx';
|
||||
import { FixedLayoutSimple } from './fixed-layout-simple.tsx';
|
||||
|
||||
export function CompositeNodesPreview(props: { cellHeight?: number }) {
|
||||
const previewWidth = '50%';
|
||||
const editorWidth = '50%';
|
||||
const cellHeight = props.cellHeight || 300;
|
||||
return (
|
||||
<table
|
||||
className=""
|
||||
style={{
|
||||
width: '100%',
|
||||
border: '1px solid var(--rp-c-divider-light)',
|
||||
zIndex: 1,
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
<tr>
|
||||
<td style={{ textAlign: 'center' }}>dynamicSplit</td>
|
||||
<td>
|
||||
<PreviewEditor
|
||||
codeInRight
|
||||
files={{
|
||||
'index.tsx': {
|
||||
code: dynamicSplit,
|
||||
active: true,
|
||||
},
|
||||
}}
|
||||
previewStyle={{
|
||||
width: previewWidth,
|
||||
height: cellHeight,
|
||||
position: 'relative',
|
||||
}}
|
||||
editorStyle={{
|
||||
width: editorWidth,
|
||||
height: cellHeight,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple hideTools demo="dynamicSplit" />
|
||||
</PreviewEditor>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{ textAlign: 'center' }}>loop</td>
|
||||
<td>
|
||||
<PreviewEditor
|
||||
codeInRight
|
||||
files={{
|
||||
'index.tsx': {
|
||||
code: loop,
|
||||
active: true,
|
||||
},
|
||||
}}
|
||||
previewStyle={{
|
||||
width: previewWidth,
|
||||
height: cellHeight,
|
||||
position: 'relative',
|
||||
}}
|
||||
editorStyle={{
|
||||
height: cellHeight,
|
||||
width: editorWidth,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple hideTools demo="loop" />
|
||||
</PreviewEditor>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{ textAlign: 'center' }}>tryCatch</td>
|
||||
<td>
|
||||
<PreviewEditor
|
||||
codeInRight
|
||||
files={{
|
||||
'index.tsx': {
|
||||
code: tryCatch,
|
||||
active: true,
|
||||
},
|
||||
}}
|
||||
previewStyle={{
|
||||
width: previewWidth,
|
||||
height: cellHeight,
|
||||
position: 'relative',
|
||||
}}
|
||||
editorStyle={{
|
||||
height: cellHeight,
|
||||
width: editorWidth,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple hideTools demo="tryCatch" />
|
||||
</PreviewEditor>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{ textAlign: 'center' }}>multiInputs</td>
|
||||
<td>
|
||||
<PreviewEditor
|
||||
codeInRight
|
||||
files={{
|
||||
'index.tsx': {
|
||||
code: multiInputs,
|
||||
active: true,
|
||||
},
|
||||
}}
|
||||
previewStyle={{
|
||||
width: previewWidth,
|
||||
height: cellHeight,
|
||||
position: 'relative',
|
||||
}}
|
||||
editorStyle={{
|
||||
height: cellHeight,
|
||||
width: editorWidth,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple hideTools demo="multiInputs" />
|
||||
</PreviewEditor>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{ textAlign: 'center' }}>multiOutputs</td>
|
||||
<td>
|
||||
<PreviewEditor
|
||||
codeInRight
|
||||
files={{
|
||||
'index.tsx': {
|
||||
code: multiOutputs,
|
||||
active: true,
|
||||
},
|
||||
}}
|
||||
previewStyle={{
|
||||
width: previewWidth,
|
||||
height: cellHeight,
|
||||
position: 'relative',
|
||||
}}
|
||||
editorStyle={{
|
||||
height: cellHeight,
|
||||
width: editorWidth,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple hideTools demo="multiOutputs" />
|
||||
</PreviewEditor>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{ textAlign: 'center' }}>slot</td>
|
||||
<td>
|
||||
<PreviewEditor
|
||||
codeInRight
|
||||
files={{
|
||||
'index.tsx': {
|
||||
code: slot,
|
||||
active: true,
|
||||
},
|
||||
}}
|
||||
previewStyle={{
|
||||
width: previewWidth,
|
||||
height: cellHeight,
|
||||
position: 'relative',
|
||||
}}
|
||||
editorStyle={{
|
||||
height: cellHeight,
|
||||
width: editorWidth,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple hideTools demo="slot" />
|
||||
</PreviewEditor>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
// https://github.com/web-infra-dev/rspress/issues/553
|
||||
const FixedLayoutSimple = React.lazy(() =>
|
||||
import('@flowgram.ai/demo-fixed-layout-simple').then((module) => ({
|
||||
default: module.DemoFixedLayout,
|
||||
}))
|
||||
);
|
||||
|
||||
export { FixedLayoutSimple };
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
export { FixedLayoutSimple } from './fixed-layout-simple.tsx';
|
||||
export { CompositeNodesPreview } from './composite-nodes-preview.tsx';
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-unresolved */
|
||||
|
||||
import nodeRegistriesCode from '@flowgram.ai/demo-fixed-layout-simple/src/node-registries.ts?raw';
|
||||
import initialDataCode from '@flowgram.ai/demo-fixed-layout-simple/src/initial-data.ts?raw';
|
||||
import indexCssCode from '@flowgram.ai/demo-fixed-layout-simple/src/index.css?raw';
|
||||
import useEditorPropsCode from '@flowgram.ai/demo-fixed-layout-simple/src/hooks/use-editor-props.tsx?raw';
|
||||
import editorCode from '@flowgram.ai/demo-fixed-layout-simple/src/editor.tsx?raw';
|
||||
import toolsCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/tools.tsx?raw';
|
||||
import nodeAdderCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/node-adder.tsx?raw';
|
||||
import miniMapCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/minimap.tsx?raw';
|
||||
import branchAdderCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/branch-adder.tsx?raw';
|
||||
import baseNodeCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/base-node.tsx?raw';
|
||||
|
||||
import { FixedLayoutSimple } from './index';
|
||||
import { PreviewEditor } from '../preview-editor';
|
||||
|
||||
const indexCode = {
|
||||
code: editorCode,
|
||||
active: true,
|
||||
};
|
||||
|
||||
export const FixedLayoutSimplePreview = () => (
|
||||
<div
|
||||
style={{
|
||||
zIndex: 1,
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
<PreviewEditor
|
||||
files={{
|
||||
'editor.tsx': indexCode,
|
||||
'index.css': indexCssCode,
|
||||
'initial-data.ts': initialDataCode,
|
||||
'node-registries.ts': nodeRegistriesCode,
|
||||
'use-editor-props.tsx': useEditorPropsCode,
|
||||
'base-node.tsx': baseNodeCode,
|
||||
'branch-adder.tsx': branchAdderCode,
|
||||
'minimap.tsx': miniMapCode,
|
||||
'node-adder.tsx': nodeAdderCode,
|
||||
'tools.tsx': toolsCode,
|
||||
}}
|
||||
previewStyle={{
|
||||
height: 500,
|
||||
}}
|
||||
editorStyle={{
|
||||
height: 500,
|
||||
}}
|
||||
>
|
||||
<FixedLayoutSimple />
|
||||
</PreviewEditor>
|
||||
</div>
|
||||
);
|
||||
Reference in New Issue
Block a user