feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
const { defineConfig } = require('@coze-arch/stylelint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
extends: [],
|
||||
});
|
||||
112
frontend/packages/common/flowgram-adapter/common/README.md
Normal file
112
frontend/packages/common/flowgram-adapter/common/README.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# @flowgram-adapter/common
|
||||
|
||||
对 flowgram 的封装
|
||||
|
||||
## Overview
|
||||
|
||||
This package is part of the Coze Studio monorepo and provides utilities functionality. It includes service, plugin, logger.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Installation
|
||||
|
||||
Add this package to your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"@flowgram-adapter/common": "workspace:*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
rush update
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```typescript
|
||||
import { /* exported functions/components */ } from '@flowgram-adapter/common';
|
||||
|
||||
// Example usage
|
||||
// TODO: Add specific usage examples
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Service
|
||||
- Plugin
|
||||
- Logger
|
||||
|
||||
## API Reference
|
||||
|
||||
### Exports
|
||||
|
||||
- `useObserve, ReactiveState`
|
||||
- `type IPoint,
|
||||
type PaddingSchema,
|
||||
type PositionSchema,
|
||||
type AsClass,
|
||||
type MaybePromise,
|
||||
type MaybeArray,
|
||||
type SchemaDecoration,
|
||||
type CancellationToken,
|
||||
type RecursivePartial,
|
||||
bindContributions,
|
||||
domUtils,
|
||||
Rectangle,
|
||||
DisposableCollection,
|
||||
delay,
|
||||
Emitter,
|
||||
logger,
|
||||
SizeSchema,
|
||||
Disposable,
|
||||
ContributionProvider,
|
||||
bindContributionProvider,
|
||||
pick,
|
||||
useRefresh,
|
||||
Event,
|
||||
addEventListener,
|
||||
isNumber,
|
||||
isObject,
|
||||
CancellationTokenSource,
|
||||
PromiseDeferred,
|
||||
Deferred,
|
||||
DecorationStyle,
|
||||
isFunction,
|
||||
compose,`
|
||||
- `type HistoryPluginOptions,
|
||||
type Operation,
|
||||
createHistoryPlugin,
|
||||
HistoryService,
|
||||
OperationService,`
|
||||
- `type CommandHandler,
|
||||
CommandContainerModule,
|
||||
CommandRegistry,
|
||||
Command,
|
||||
CommandService,
|
||||
CommandContribution,
|
||||
CommandRegistryFactory,`
|
||||
|
||||
|
||||
For detailed API documentation, please refer to the TypeScript definitions.
|
||||
|
||||
## Development
|
||||
|
||||
This package is built with:
|
||||
|
||||
- TypeScript
|
||||
- Modern JavaScript
|
||||
- Vitest for testing
|
||||
- ESLint for code quality
|
||||
|
||||
## Contributing
|
||||
|
||||
This package is part of the Coze Studio monorepo. Please follow the monorepo contribution guidelines.
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"operationSettings": [
|
||||
{
|
||||
"operationName": "test:cov",
|
||||
"outputFolderNames": ["coverage"]
|
||||
},
|
||||
{
|
||||
"operationName": "ts-check",
|
||||
"outputFolderNames": ["./dist"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
const { defineConfig } = require('@coze-arch/eslint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
packageRoot: __dirname,
|
||||
preset: 'web',
|
||||
rules: {
|
||||
'no-cond-assign': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'max-params': 'off',
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "@flowgram-adapter/common",
|
||||
"version": "0.0.1",
|
||||
"description": "对 flowgram 的封装",
|
||||
"license": "Apache-2.0",
|
||||
"author": "wencheng.lwc@bytedance.com",
|
||||
"maintainers": [],
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"files": [
|
||||
"src",
|
||||
"bin"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "exit 0",
|
||||
"lint": "eslint ./ --cache",
|
||||
"test": "vitest --run --passWithNoTests",
|
||||
"test:cov": "npm run test -- --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@flowgram.ai/command": "0.1.28",
|
||||
"@flowgram.ai/history": "0.1.28",
|
||||
"@flowgram.ai/reactive": "0.1.28",
|
||||
"@flowgram.ai/utils": "0.1.28",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.0",
|
||||
"@coze-arch/eslint-config": "workspace:*",
|
||||
"@coze-arch/stylelint-config": "workspace:*",
|
||||
"@coze-arch/ts-config": "workspace:*",
|
||||
"@coze-arch/vitest-config": "workspace:*",
|
||||
"@testing-library/jest-dom": "^6.1.5",
|
||||
"@testing-library/react": "^14.1.2",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/node": "^18",
|
||||
"@types/react": "18.2.37",
|
||||
"@types/react-dom": "18.2.15",
|
||||
"@vitest/coverage-v8": "~3.0.5",
|
||||
"react": "~18.2.0",
|
||||
"react-dom": "~18.2.0",
|
||||
"react-is": ">= 16.8.0",
|
||||
"styled-components": ">=4",
|
||||
"stylelint": "^15.11.0",
|
||||
"vitest": "~3.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18.2.0",
|
||||
"react-dom": ">=18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import 'reflect-metadata';
|
||||
export { useObserve, ReactiveState } from '@flowgram.ai/reactive';
|
||||
export {
|
||||
type IPoint,
|
||||
type PaddingSchema,
|
||||
type PositionSchema,
|
||||
type AsClass,
|
||||
type MaybePromise,
|
||||
type MaybeArray,
|
||||
type SchemaDecoration,
|
||||
type CancellationToken,
|
||||
type RecursivePartial,
|
||||
bindContributions,
|
||||
domUtils,
|
||||
Rectangle,
|
||||
DisposableCollection,
|
||||
delay,
|
||||
Emitter,
|
||||
logger,
|
||||
SizeSchema,
|
||||
Disposable,
|
||||
ContributionProvider,
|
||||
bindContributionProvider,
|
||||
pick,
|
||||
useRefresh,
|
||||
Event,
|
||||
addEventListener,
|
||||
isNumber,
|
||||
isObject,
|
||||
CancellationTokenSource,
|
||||
PromiseDeferred,
|
||||
Deferred,
|
||||
DecorationStyle,
|
||||
isFunction,
|
||||
compose,
|
||||
} from '@flowgram.ai/utils';
|
||||
export {
|
||||
type HistoryPluginOptions,
|
||||
type Operation,
|
||||
createHistoryPlugin,
|
||||
HistoryService,
|
||||
OperationService,
|
||||
} from '@flowgram.ai/history';
|
||||
export {
|
||||
type CommandHandler,
|
||||
CommandContainerModule,
|
||||
CommandRegistry,
|
||||
Command,
|
||||
CommandService,
|
||||
CommandContribution,
|
||||
CommandRegistryFactory,
|
||||
} from '@flowgram.ai/command';
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {},
|
||||
"types": [],
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"preserveSymlinks": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"module": "ESNext",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../../config/eslint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/stylelint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/ts-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/vitest-config/tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"$schema": "https://json.schemastore.org/tsconfig"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.misc.json"
|
||||
}
|
||||
],
|
||||
"exclude": ["**/*"]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"include": ["__tests__", "stories", "vitest.config.ts", "tailwind.config.ts"],
|
||||
"exclude": ["**/node_modules", "./dist"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {},
|
||||
"types": ["react", "react-dom"],
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"preserveSymlinks": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"module": "ESNext",
|
||||
"rootDir": "./",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { defineConfig } from '@coze-arch/vitest-config';
|
||||
|
||||
export default defineConfig({
|
||||
dirname: __dirname,
|
||||
preset: 'web',
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
const { defineConfig } = require('@coze-arch/stylelint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
extends: [],
|
||||
});
|
||||
@@ -0,0 +1,137 @@
|
||||
# @flowgram-adapter/fixed-layout-editor
|
||||
|
||||
对 flowgram 的封装
|
||||
|
||||
## Overview
|
||||
|
||||
This package is part of the Coze Studio monorepo and provides utilities functionality. It includes service, manager, editor and more.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Installation
|
||||
|
||||
Add this package to your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"@flowgram-adapter/fixed-layout-editor": "workspace:*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
rush update
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```typescript
|
||||
import { /* exported functions/components */ } from '@flowgram-adapter/fixed-layout-editor';
|
||||
|
||||
// Example usage
|
||||
// TODO: Add specific usage examples
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Service
|
||||
- Manager
|
||||
- Editor
|
||||
- Plugin
|
||||
|
||||
## API Reference
|
||||
|
||||
### Exports
|
||||
|
||||
- `type FlowNodeEntity,
|
||||
type CollapseProps,
|
||||
type IPoint,
|
||||
type EntityOpts,
|
||||
type PluginsProvider,
|
||||
type Plugin,
|
||||
type ClipboardService,
|
||||
type EditorPluginContext,
|
||||
type FlowDocumentJSON,
|
||||
type FlowLayoutDefault,
|
||||
type FlowOperationService,
|
||||
type SelectionService,
|
||||
type FixedHistoryPluginOptions,
|
||||
type HistoryService,
|
||||
type FlowRendererRegistry,
|
||||
type NodeFormProps,
|
||||
type FixedLayoutProps,
|
||||
type FlowNodeRegistry,
|
||||
type FlowNodeRegistry as FlowNodeRegister,
|
||||
type PluginCreator,
|
||||
type PositionSchema,
|
||||
type FlowNodeJSON,
|
||||
type FlowNodeMeta,
|
||||
useConfigEntity,
|
||||
useService,
|
||||
useBaseColor,
|
||||
EntityManager,
|
||||
useRefresh,
|
||||
Rectangle,
|
||||
usePlayground,
|
||||
EditorState,
|
||||
usePlaygroundTools,
|
||||
ConfigEntity,
|
||||
FlowDocument,
|
||||
createPluginContextDefault,
|
||||
PlaygroundReactProvider,
|
||||
bindContributions,
|
||||
FlowDocumentContribution,
|
||||
FlowRendererContribution,
|
||||
createOperationPlugin,
|
||||
createDefaultPreset,
|
||||
createPlaygroundPlugin,
|
||||
FlowDocumentOptionsDefault,
|
||||
FlowDocumentOptions,
|
||||
FlowNodesContentLayer,
|
||||
FlowNodesTransformLayer,
|
||||
FlowScrollBarLayer,
|
||||
FlowScrollLimitLayer,
|
||||
EditorProps,
|
||||
FlowNodeRenderData,
|
||||
FlowNodeTransformData,
|
||||
FlowNodeTransitionData,
|
||||
PlaygroundLayer,
|
||||
FixedLayoutRegistries,
|
||||
ConstantKeys,
|
||||
PlaygroundEntityContext,
|
||||
getNodeForm,
|
||||
FlowRendererKey,
|
||||
EditorRenderer,
|
||||
FlowDocumentTransformerEntity,
|
||||
Layer,
|
||||
observeEntity,
|
||||
domUtils,
|
||||
FlowNodeBaseType,
|
||||
bindConfigEntity,
|
||||
definePluginCreator,
|
||||
Emitter,
|
||||
Point,
|
||||
createPlaygroundReactPreset,`
|
||||
|
||||
|
||||
For detailed API documentation, please refer to the TypeScript definitions.
|
||||
|
||||
## Development
|
||||
|
||||
This package is built with:
|
||||
|
||||
- TypeScript
|
||||
- Modern JavaScript
|
||||
- Vitest for testing
|
||||
- ESLint for code quality
|
||||
|
||||
## Contributing
|
||||
|
||||
This package is part of the Coze Studio monorepo. Please follow the monorepo contribution guidelines.
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"operationSettings": [
|
||||
{
|
||||
"operationName": "test:cov",
|
||||
"outputFolderNames": ["coverage"]
|
||||
},
|
||||
{
|
||||
"operationName": "ts-check",
|
||||
"outputFolderNames": ["./dist"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
const { defineConfig } = require('@coze-arch/eslint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
packageRoot: __dirname,
|
||||
preset: 'web',
|
||||
rules: {
|
||||
'no-cond-assign': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'max-params': 'off',
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "@flowgram-adapter/fixed-layout-editor",
|
||||
"version": "0.0.1",
|
||||
"description": "对 flowgram 的封装",
|
||||
"license": "Apache-2.0",
|
||||
"author": "wencheng.lwc@bytedance.com",
|
||||
"maintainers": [],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"import": "./src/index.ts",
|
||||
"require": "./src/index.ts"
|
||||
},
|
||||
"./css-load": {
|
||||
"types": "./src/css-load.ts",
|
||||
"import": "./src/css-load.ts",
|
||||
"require": "./src/css-load.ts"
|
||||
}
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"files": [
|
||||
"src",
|
||||
"bin"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "exit 0",
|
||||
"lint": "eslint ./ --cache",
|
||||
"test": "vitest --run --passWithNoTests",
|
||||
"test:cov": "npm run test -- --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@flowgram.ai/fixed-layout-editor": "0.1.28",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.0",
|
||||
"@coze-arch/eslint-config": "workspace:*",
|
||||
"@coze-arch/stylelint-config": "workspace:*",
|
||||
"@coze-arch/ts-config": "workspace:*",
|
||||
"@coze-arch/vitest-config": "workspace:*",
|
||||
"@testing-library/jest-dom": "^6.1.5",
|
||||
"@testing-library/react": "^14.1.2",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/node": "^18",
|
||||
"@types/react": "18.2.37",
|
||||
"@types/react-dom": "18.2.15",
|
||||
"@vitest/coverage-v8": "~3.0.5",
|
||||
"react": "~18.2.0",
|
||||
"react-dom": "~18.2.0",
|
||||
"react-is": ">= 16.8.0",
|
||||
"styled-components": ">=4",
|
||||
"stylelint": "^15.11.0",
|
||||
"vitest": "~3.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18.2.0",
|
||||
"react-dom": ">=18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import '@flowgram.ai/fixed-layout-editor/index.css';
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import 'reflect-metadata';
|
||||
export {
|
||||
type FlowNodeEntity,
|
||||
type CollapseProps,
|
||||
type IPoint,
|
||||
type EntityOpts,
|
||||
type PluginsProvider,
|
||||
type Plugin,
|
||||
type ClipboardService,
|
||||
type EditorPluginContext,
|
||||
type FlowDocumentJSON,
|
||||
type FlowLayoutDefault,
|
||||
type FlowOperationService,
|
||||
type SelectionService,
|
||||
type FixedHistoryPluginOptions,
|
||||
type HistoryService,
|
||||
type FlowRendererRegistry,
|
||||
type NodeFormProps,
|
||||
type FixedLayoutProps,
|
||||
type FlowNodeRegistry,
|
||||
type FlowNodeRegistry as FlowNodeRegister,
|
||||
type PluginCreator,
|
||||
type PositionSchema,
|
||||
type FlowNodeJSON,
|
||||
type FlowNodeMeta,
|
||||
useConfigEntity,
|
||||
useService,
|
||||
useBaseColor,
|
||||
EntityManager,
|
||||
useRefresh,
|
||||
Rectangle,
|
||||
usePlayground,
|
||||
EditorState,
|
||||
usePlaygroundTools,
|
||||
ConfigEntity,
|
||||
FlowDocument,
|
||||
createPluginContextDefault,
|
||||
PlaygroundReactProvider,
|
||||
bindContributions,
|
||||
FlowDocumentContribution,
|
||||
FlowRendererContribution,
|
||||
createOperationPlugin,
|
||||
createDefaultPreset,
|
||||
createPlaygroundPlugin,
|
||||
FlowDocumentOptionsDefault,
|
||||
FlowDocumentOptions,
|
||||
FlowNodesContentLayer,
|
||||
FlowNodesTransformLayer,
|
||||
FlowScrollBarLayer,
|
||||
FlowScrollLimitLayer,
|
||||
EditorProps,
|
||||
FlowNodeRenderData,
|
||||
FlowNodeTransformData,
|
||||
FlowNodeTransitionData,
|
||||
PlaygroundLayer,
|
||||
FixedLayoutRegistries,
|
||||
ConstantKeys,
|
||||
PlaygroundEntityContext,
|
||||
getNodeForm,
|
||||
FlowRendererKey,
|
||||
EditorRenderer,
|
||||
FlowDocumentTransformerEntity,
|
||||
Layer,
|
||||
observeEntity,
|
||||
domUtils,
|
||||
FlowNodeBaseType,
|
||||
bindConfigEntity,
|
||||
definePluginCreator,
|
||||
Emitter,
|
||||
Point,
|
||||
createPlaygroundReactPreset,
|
||||
} from '@flowgram.ai/fixed-layout-editor';
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {},
|
||||
"types": [],
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"preserveSymlinks": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"module": "ESNext",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../../config/eslint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/stylelint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/ts-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/vitest-config/tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"$schema": "https://json.schemastore.org/tsconfig"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.misc.json"
|
||||
}
|
||||
],
|
||||
"exclude": ["**/*"]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"include": ["__tests__", "stories", "vitest.config.ts", "tailwind.config.ts"],
|
||||
"exclude": ["**/node_modules", "./dist"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {},
|
||||
"types": ["react", "react-dom"],
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"preserveSymlinks": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"module": "ESNext",
|
||||
"rootDir": "./",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { defineConfig } from '@coze-arch/vitest-config';
|
||||
|
||||
export default defineConfig({
|
||||
dirname: __dirname,
|
||||
preset: 'web',
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
const { defineConfig } = require('@coze-arch/stylelint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
extends: [],
|
||||
});
|
||||
@@ -0,0 +1,261 @@
|
||||
# @flowgram-adapter/free-layout-editor
|
||||
|
||||
对 flowgram 的封装
|
||||
|
||||
## Overview
|
||||
|
||||
This package is part of the Coze Studio monorepo and provides utilities functionality. It includes component, store, service and more.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Installation
|
||||
|
||||
Add this package to your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"@flowgram-adapter/free-layout-editor": "workspace:*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
rush update
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```typescript
|
||||
import { /* exported functions/components */ } from '@flowgram-adapter/free-layout-editor';
|
||||
|
||||
// Example usage
|
||||
// TODO: Add specific usage examples
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Component
|
||||
- Store
|
||||
- Service
|
||||
- Manager
|
||||
- Editor
|
||||
- Plugin
|
||||
- Validation
|
||||
- Logger
|
||||
|
||||
## API Reference
|
||||
|
||||
### Exports
|
||||
|
||||
- `FlowMinimapService,
|
||||
MinimapRender,
|
||||
createMinimapPlugin,`
|
||||
- `type WorkflowNodeJSON,
|
||||
type InteractiveType,
|
||||
type WorkflowNodeRegistry,
|
||||
type WorkflowNodeMeta,
|
||||
type WorkflowLinePortInfo,
|
||||
type WorkflowJSON,
|
||||
type WorkflowContentChangeEvent,
|
||||
type WorkflowSubCanvas,
|
||||
type WorkflowNodeRenderProps,
|
||||
type WorkflowPortType,
|
||||
type WorkflowNodeFormMeta,
|
||||
LineType,
|
||||
usePlayground,
|
||||
useService,
|
||||
WorkflowContentChangeType,
|
||||
WorkflowDocument,
|
||||
useCurrentEntity,
|
||||
useNodeRender,
|
||||
WorkflowHoverService,
|
||||
WorkflowSelectService,
|
||||
WorkflowDocumentOptions,
|
||||
WorkflowNodeEntity,
|
||||
WorkflowCommands,
|
||||
WorkflowNodeLinesData,
|
||||
WorkflowNodePortsData,
|
||||
WorkflowPortEntity,
|
||||
nanoid,
|
||||
WorkflowDocumentContainerModule,
|
||||
WorkflowLinesManager,
|
||||
LineColors,
|
||||
useRefresh,
|
||||
getAntiOverlapPosition,
|
||||
bindConfigEntity,
|
||||
WorkflowDragService,
|
||||
delay,
|
||||
WorkflowLineEntity,
|
||||
WorkflowResetLayoutService,
|
||||
WorkflowDocumentProvider,
|
||||
POINT_RADIUS,
|
||||
WorkflowLineRenderData,
|
||||
usePlaygroundReadonlyState,
|
||||
type WorkflowEdgeJSON,`
|
||||
- `FormModelV2,
|
||||
type FieldRenderProps,
|
||||
type PlaygroundTools,
|
||||
type FieldError,
|
||||
type FieldName,
|
||||
type IForm,
|
||||
type IField,
|
||||
type IFieldArray,
|
||||
type FieldState,
|
||||
type FormMeta as FormMetaV2,
|
||||
type FormMeta,
|
||||
type Validate,
|
||||
type FieldArrayRenderProps,
|
||||
type Effect,
|
||||
type FormRenderProps,
|
||||
type EffectOptions,
|
||||
type FieldWarning,
|
||||
usePlaygroundTools,
|
||||
isFormV2,
|
||||
Field,
|
||||
Form,
|
||||
PlaygroundEntityContext,
|
||||
FieldArray,
|
||||
useFieldValidate,
|
||||
useCurrentField,
|
||||
useCurrentFieldState,
|
||||
useForm,
|
||||
useWatch,
|
||||
// useFormItemValidate,
|
||||
ValidateTrigger,
|
||||
useWatchFormErrors,
|
||||
DataEvent,
|
||||
useField,
|
||||
FlowNodeVariableData,
|
||||
ASTKind,
|
||||
createEffectOptions,
|
||||
Emitter,`
|
||||
- `type PluginCreator,
|
||||
type PluginContext,
|
||||
type PositionSchema,
|
||||
type PlaygroundConfigRevealOpts,
|
||||
type PlaygroundDragEvent,
|
||||
type LayerOptions,
|
||||
type Plugin,
|
||||
EntityData,
|
||||
PositionData,
|
||||
useEntityFromContext,
|
||||
ClipboardService,
|
||||
ConfigEntity,
|
||||
Layer,
|
||||
PlaygroundConfigEntity,
|
||||
observeEntity,
|
||||
PlaygroundReactRenderer,
|
||||
PlaygroundMockTools,
|
||||
PlaygroundContext,
|
||||
bindContributions,
|
||||
Playground,
|
||||
loadPlugins,
|
||||
EntityManagerContribution,
|
||||
definePluginCreator,
|
||||
TransformData,
|
||||
EntityManager,
|
||||
LoggerEvent,
|
||||
LoggerService,
|
||||
lazyInject,
|
||||
useConfigEntity,
|
||||
SelectionService,
|
||||
SCALE_WIDTH,
|
||||
EditorState,
|
||||
EditorStateConfigEntity,
|
||||
observeEntities,
|
||||
observeEntityDatas,
|
||||
PlaygroundContribution,
|
||||
PlaygroundLayer,
|
||||
PlaygroundReactProvider,
|
||||
CommandRegistry,`
|
||||
- `type FlowNodeJSON,
|
||||
type FlowNodeType,
|
||||
FlowNodeRenderData,
|
||||
FlowDocumentContribution,
|
||||
FlowNodeTransformData,
|
||||
FlowDocumentContainerModule,
|
||||
FlowNodeBaseType,
|
||||
FlowNodeEntity,
|
||||
FlowDocument,`
|
||||
- `type FeedbackStatus,
|
||||
type SetterComponentProps,
|
||||
type NodeManager,
|
||||
type SetterOrDecoratorContext,
|
||||
type FormItemFeedback,
|
||||
type DecoratorComponentProps,
|
||||
type DecoratorExtension,
|
||||
type SetterExtension,
|
||||
type ValidatorProps,
|
||||
type SetterAbilityOptions,
|
||||
type FormItemMaterialContext,
|
||||
type FormDataTypeName,
|
||||
type IFormItemMeta,
|
||||
FlowNodeFormData,
|
||||
FlowNodeErrorData,
|
||||
FormModelFactory,
|
||||
createNodeContainerModules,
|
||||
createNodeEntityDatas,
|
||||
NodeRender,
|
||||
getNodeError,
|
||||
registerNodeErrorRender,
|
||||
registerNodePlaceholderRender,
|
||||
FormContribution,
|
||||
NodeContribution,
|
||||
DecoratorAbility,
|
||||
SetterAbility,
|
||||
FormManager,
|
||||
type NodeErrorRenderProps,
|
||||
FormPathService,
|
||||
type NodeContext,
|
||||
type NodeFormContext,`
|
||||
- `type FlowSelectorBoundsLayerOptions,
|
||||
SelectorBoxConfigEntity,
|
||||
FlowRendererKey,
|
||||
FlowRendererRegistry,
|
||||
FlowRendererContribution,
|
||||
FlowDebugLayer,
|
||||
FlowNodesContentLayer,
|
||||
FlowNodesTransformLayer,
|
||||
FlowScrollBarLayer,
|
||||
FlowSelectorBoundsLayer,
|
||||
FlowSelectorBoxLayer,
|
||||
FlowRendererContainerModule,`
|
||||
- `type DragNodeOperationValue,
|
||||
type AddOrDeleteLineOperationValue,
|
||||
type AddOrDeleteWorkflowNodeOperationValue,
|
||||
type ChangeNodeDataValue,
|
||||
createFreeHistoryPlugin,
|
||||
FreeOperationType,
|
||||
HistoryService,`
|
||||
- `// FormRehajeContainerModule,
|
||||
// registerValidationErrorMessages,
|
||||
// useFormItemContext,
|
||||
// markParsed,
|
||||
//`
|
||||
- `type NodePanelRenderProps,
|
||||
WorkflowNodePanelService,
|
||||
createFreeNodePanelPlugin,`
|
||||
|
||||
*And more...*
|
||||
|
||||
For detailed API documentation, please refer to the TypeScript definitions.
|
||||
|
||||
## Development
|
||||
|
||||
This package is built with:
|
||||
|
||||
- TypeScript
|
||||
- Modern JavaScript
|
||||
- Vitest for testing
|
||||
- ESLint for code quality
|
||||
|
||||
## Contributing
|
||||
|
||||
This package is part of the Coze Studio monorepo. Please follow the monorepo contribution guidelines.
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"operationSettings": [
|
||||
{
|
||||
"operationName": "test:cov",
|
||||
"outputFolderNames": ["coverage"]
|
||||
},
|
||||
{
|
||||
"operationName": "ts-check",
|
||||
"outputFolderNames": ["./dist"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
const { defineConfig } = require('@coze-arch/eslint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
packageRoot: __dirname,
|
||||
preset: 'web',
|
||||
rules: {
|
||||
'no-cond-assign': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@coze-arch/no-batch-import-or-export': 'off',
|
||||
'max-params': 'off',
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": "@flowgram-adapter/free-layout-editor",
|
||||
"version": "0.0.1",
|
||||
"description": "对 flowgram 的封装",
|
||||
"license": "Apache-2.0",
|
||||
"author": "wencheng.lwc@bytedance.com",
|
||||
"maintainers": [],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"import": "./src/index.ts",
|
||||
"require": "./src/index.ts"
|
||||
},
|
||||
"./css-load": {
|
||||
"types": "./src/css-load.ts",
|
||||
"import": "./src/css-load.ts",
|
||||
"require": "./src/css-load.ts"
|
||||
}
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"files": [
|
||||
"src",
|
||||
"bin"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "exit 0",
|
||||
"lint": "eslint ./ --cache",
|
||||
"test": "vitest --run --passWithNoTests",
|
||||
"test:cov": "npm run test -- --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@flowgram.ai/core": "0.1.28",
|
||||
"@flowgram.ai/document": "0.1.28",
|
||||
"@flowgram.ai/form": "0.1.28",
|
||||
"@flowgram.ai/form-core": "0.1.28",
|
||||
"@flowgram.ai/free-auto-layout-plugin": "0.1.28",
|
||||
"@flowgram.ai/free-container-plugin": "0.1.28",
|
||||
"@flowgram.ai/free-history-plugin": "0.1.28",
|
||||
"@flowgram.ai/free-layout-core": "0.1.28",
|
||||
"@flowgram.ai/free-layout-editor": "0.1.28",
|
||||
"@flowgram.ai/free-lines-plugin": "0.1.28",
|
||||
"@flowgram.ai/free-node-panel-plugin": "0.1.28",
|
||||
"@flowgram.ai/free-snap-plugin": "0.1.28",
|
||||
"@flowgram.ai/free-stack-plugin": "0.1.28",
|
||||
"@flowgram.ai/history-node-plugin": "0.1.28",
|
||||
"@flowgram.ai/minimap-plugin": "0.1.28",
|
||||
"@flowgram.ai/node-core-plugin": "0.1.28",
|
||||
"@flowgram.ai/node-variable-plugin": "0.1.28",
|
||||
"@flowgram.ai/renderer": "0.1.28",
|
||||
"@flowgram.ai/variable-plugin": "0.1.28",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.0",
|
||||
"@coze-arch/eslint-config": "workspace:*",
|
||||
"@coze-arch/stylelint-config": "workspace:*",
|
||||
"@coze-arch/ts-config": "workspace:*",
|
||||
"@coze-arch/vitest-config": "workspace:*",
|
||||
"@testing-library/jest-dom": "^6.1.5",
|
||||
"@testing-library/react": "^14.1.2",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/node": "^18",
|
||||
"@types/react": "18.2.37",
|
||||
"@types/react-dom": "18.2.15",
|
||||
"@vitest/coverage-v8": "~3.0.5",
|
||||
"react": "~18.2.0",
|
||||
"react-dom": "~18.2.0",
|
||||
"react-is": ">= 16.8.0",
|
||||
"styled-components": ">=4",
|
||||
"stylelint": "^15.11.0",
|
||||
"vitest": "~3.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18.2.0",
|
||||
"react-dom": ">=18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import '@flowgram.ai/free-layout-editor/index.css';
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param val
|
||||
*/
|
||||
export function markParsed(val: any) {
|
||||
console.error('[flowgram.ai] "markParsed" is deprecated.');
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param ctx
|
||||
*/
|
||||
export function useFormItemValidate(ctx: any) {
|
||||
// D Nothing
|
||||
console.error('[flowgram.ai] "useFormItemValidate" is deprecated.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param ctx
|
||||
*/
|
||||
export function useFormItemContext(ctx: any) {
|
||||
// DO Nothing
|
||||
console.error('[flowgram.ai] "useFormItemContext" is deprecated.');
|
||||
return {};
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import 'reflect-metadata';
|
||||
export {
|
||||
FlowMinimapService,
|
||||
MinimapRender,
|
||||
createMinimapPlugin,
|
||||
} from '@flowgram.ai/minimap-plugin';
|
||||
export {
|
||||
type WorkflowNodeJSON,
|
||||
type InteractiveType,
|
||||
type WorkflowNodeRegistry,
|
||||
type WorkflowNodeMeta,
|
||||
type WorkflowLinePortInfo,
|
||||
type WorkflowJSON,
|
||||
type WorkflowContentChangeEvent,
|
||||
type WorkflowSubCanvas,
|
||||
type WorkflowNodeRenderProps,
|
||||
type WorkflowPortType,
|
||||
type WorkflowNodeFormMeta,
|
||||
LineType,
|
||||
usePlayground,
|
||||
useService,
|
||||
WorkflowContentChangeType,
|
||||
WorkflowDocument,
|
||||
useCurrentEntity,
|
||||
useNodeRender,
|
||||
WorkflowHoverService,
|
||||
WorkflowSelectService,
|
||||
WorkflowDocumentOptions,
|
||||
WorkflowNodeEntity,
|
||||
WorkflowCommands,
|
||||
WorkflowNodeLinesData,
|
||||
WorkflowNodePortsData,
|
||||
WorkflowPortEntity,
|
||||
nanoid,
|
||||
WorkflowDocumentContainerModule,
|
||||
WorkflowLinesManager,
|
||||
LineColors,
|
||||
useRefresh,
|
||||
getAntiOverlapPosition,
|
||||
bindConfigEntity,
|
||||
WorkflowDragService,
|
||||
delay,
|
||||
WorkflowLineEntity,
|
||||
WorkflowResetLayoutService,
|
||||
WorkflowDocumentProvider,
|
||||
POINT_RADIUS,
|
||||
WorkflowLineRenderData,
|
||||
usePlaygroundReadonlyState,
|
||||
type WorkflowEdgeJSON,
|
||||
} from '@flowgram.ai/free-layout-core';
|
||||
export {
|
||||
FormModelV2,
|
||||
type FieldRenderProps,
|
||||
type PlaygroundTools,
|
||||
type FieldError,
|
||||
type FieldName,
|
||||
type IForm,
|
||||
type IField,
|
||||
type IFieldArray,
|
||||
type FieldState,
|
||||
type FormMeta as FormMetaV2,
|
||||
type FormMeta,
|
||||
type Validate,
|
||||
type FieldArrayRenderProps,
|
||||
type Effect,
|
||||
type FormRenderProps,
|
||||
type EffectOptions,
|
||||
type FieldWarning,
|
||||
usePlaygroundTools,
|
||||
isFormV2,
|
||||
Field,
|
||||
Form,
|
||||
PlaygroundEntityContext,
|
||||
FieldArray,
|
||||
useFieldValidate,
|
||||
useCurrentField,
|
||||
useCurrentFieldState,
|
||||
useForm,
|
||||
useWatch,
|
||||
// useFormItemValidate,
|
||||
ValidateTrigger,
|
||||
useWatchFormErrors,
|
||||
DataEvent,
|
||||
useField,
|
||||
FlowNodeVariableData,
|
||||
ASTKind,
|
||||
createEffectOptions,
|
||||
Emitter,
|
||||
type FreeLayoutProps,
|
||||
} from '@flowgram.ai/free-layout-editor';
|
||||
export {
|
||||
type PluginCreator,
|
||||
type PluginContext,
|
||||
type PositionSchema,
|
||||
type PlaygroundConfigRevealOpts,
|
||||
type PlaygroundDragEvent,
|
||||
type LayerOptions,
|
||||
type Plugin,
|
||||
EntityData,
|
||||
PositionData,
|
||||
useEntityFromContext,
|
||||
ClipboardService,
|
||||
ConfigEntity,
|
||||
Layer,
|
||||
PlaygroundConfigEntity,
|
||||
observeEntity,
|
||||
PlaygroundReactRenderer,
|
||||
PlaygroundMockTools,
|
||||
PlaygroundContext,
|
||||
bindContributions,
|
||||
Playground,
|
||||
loadPlugins,
|
||||
EntityManagerContribution,
|
||||
definePluginCreator,
|
||||
TransformData,
|
||||
EntityManager,
|
||||
LoggerEvent,
|
||||
LoggerService,
|
||||
lazyInject,
|
||||
useConfigEntity,
|
||||
SelectionService,
|
||||
SCALE_WIDTH,
|
||||
EditorState,
|
||||
EditorStateConfigEntity,
|
||||
observeEntities,
|
||||
observeEntityDatas,
|
||||
PlaygroundContribution,
|
||||
PlaygroundLayer,
|
||||
PlaygroundReactProvider,
|
||||
CommandRegistry,
|
||||
} from '@flowgram.ai/core';
|
||||
export {
|
||||
type FlowNodeJSON,
|
||||
type FlowNodeType,
|
||||
FlowNodeRenderData,
|
||||
FlowDocumentContribution,
|
||||
FlowNodeTransformData,
|
||||
FlowDocumentContainerModule,
|
||||
FlowNodeBaseType,
|
||||
FlowNodeEntity,
|
||||
FlowDocument,
|
||||
} from '@flowgram.ai/document';
|
||||
export {
|
||||
type FeedbackStatus,
|
||||
type SetterComponentProps,
|
||||
type NodeManager,
|
||||
type SetterOrDecoratorContext,
|
||||
type FormItemFeedback,
|
||||
type DecoratorComponentProps,
|
||||
type DecoratorExtension,
|
||||
type SetterExtension,
|
||||
type ValidatorProps,
|
||||
type SetterAbilityOptions,
|
||||
type FormItemMaterialContext,
|
||||
type FormDataTypeName,
|
||||
type IFormItemMeta,
|
||||
FlowNodeFormData,
|
||||
FlowNodeErrorData,
|
||||
FormModelFactory,
|
||||
createNodeContainerModules,
|
||||
createNodeEntityDatas,
|
||||
NodeRender,
|
||||
getNodeError,
|
||||
registerNodeErrorRender,
|
||||
registerNodePlaceholderRender,
|
||||
FormContribution,
|
||||
NodeContribution,
|
||||
DecoratorAbility,
|
||||
SetterAbility,
|
||||
FormManager,
|
||||
type NodeErrorRenderProps,
|
||||
FormPathService,
|
||||
type NodeContext,
|
||||
type NodeFormContext,
|
||||
} from '@flowgram.ai/form-core';
|
||||
export {
|
||||
type FlowSelectorBoundsLayerOptions,
|
||||
SelectorBoxConfigEntity,
|
||||
FlowRendererKey,
|
||||
FlowRendererRegistry,
|
||||
FlowRendererContribution,
|
||||
FlowDebugLayer,
|
||||
FlowNodesContentLayer,
|
||||
FlowNodesTransformLayer,
|
||||
FlowScrollBarLayer,
|
||||
FlowSelectorBoundsLayer,
|
||||
FlowSelectorBoxLayer,
|
||||
FlowRendererContainerModule,
|
||||
} from '@flowgram.ai/renderer';
|
||||
export {
|
||||
type DragNodeOperationValue,
|
||||
type AddOrDeleteLineOperationValue,
|
||||
type AddOrDeleteWorkflowNodeOperationValue,
|
||||
type ChangeNodeDataValue,
|
||||
createFreeHistoryPlugin,
|
||||
FreeOperationType,
|
||||
HistoryService,
|
||||
type OperationMeta,
|
||||
OperationRegistry,
|
||||
OperationContribution,
|
||||
} from '@flowgram.ai/free-history-plugin';
|
||||
// export {
|
||||
// FormRehajeContainerModule,
|
||||
// registerValidationErrorMessages,
|
||||
// useFormItemContext,
|
||||
// markParsed,
|
||||
// } from '@flowgram.ai/form-rehaje';
|
||||
export {
|
||||
type NodePanelRenderProps,
|
||||
WorkflowNodePanelService,
|
||||
createFreeNodePanelPlugin,
|
||||
} from '@flowgram.ai/free-node-panel-plugin';
|
||||
export {
|
||||
type LineRenderProps,
|
||||
createFreeLinesPlugin,
|
||||
WorkflowBezierLineContribution,
|
||||
WorkflowFoldLineContribution,
|
||||
WorkflowLinesLayer,
|
||||
} from '@flowgram.ai/free-lines-plugin';
|
||||
export {
|
||||
NodeIntoContainerService,
|
||||
NodeIntoContainerType,
|
||||
createContainerNodePlugin,
|
||||
} from '@flowgram.ai/free-container-plugin';
|
||||
export { createHistoryNodePlugin } from '@flowgram.ai/history-node-plugin';
|
||||
export { createFreeSnapPlugin } from '@flowgram.ai/free-snap-plugin';
|
||||
export {
|
||||
StackingContextManager,
|
||||
createFreeStackPlugin,
|
||||
} from '@flowgram.ai/free-stack-plugin';
|
||||
export {
|
||||
type LayoutNode,
|
||||
type LayoutStore,
|
||||
type GetFollowNode,
|
||||
AutoLayoutService,
|
||||
createFreeAutoLayoutPlugin,
|
||||
} from '@flowgram.ai/free-auto-layout-plugin';
|
||||
export * from '@flowgram.ai/form';
|
||||
export {
|
||||
type Scope,
|
||||
type BaseVariableField,
|
||||
type CreateASTParams,
|
||||
type ASTNodeJSON,
|
||||
type KeyPathExpressionJSON,
|
||||
type VariablePluginOptions,
|
||||
type PropertyJSON,
|
||||
type VariableDeclarationJSON,
|
||||
type ASTNode,
|
||||
type ObjectType,
|
||||
ScopeProvider,
|
||||
VariableEngine,
|
||||
ArrayType,
|
||||
KeyPathExpression,
|
||||
BaseType,
|
||||
VariableFieldKeyRenameService,
|
||||
BaseExpression,
|
||||
postConstructAST,
|
||||
ASTFactory,
|
||||
ASTNodeFlags,
|
||||
createVariablePlugin,
|
||||
useCurrentScope,
|
||||
} from '@flowgram.ai/variable-plugin';
|
||||
export {
|
||||
type VariableProviderAbilityOptions,
|
||||
type VariableConsumerAbilityOptions,
|
||||
createNodeVariablePlugin,
|
||||
} from '@flowgram.ai/node-variable-plugin';
|
||||
export { createNodeCorePlugin } from '@flowgram.ai/node-core-plugin';
|
||||
|
||||
export { WorkflowJSONFormatContribution } from './workflow-json-format';
|
||||
export { useEntity } from './use-entity';
|
||||
export * from './deprecated';
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { useLayoutEffect } from 'react';
|
||||
|
||||
import {
|
||||
type Entity,
|
||||
EntityManager,
|
||||
type EntityRegistry,
|
||||
usePlaygroundContainer,
|
||||
useRefresh,
|
||||
} from '@flowgram.ai/free-layout-editor';
|
||||
|
||||
/**
|
||||
* 获取 entity 并监听变化
|
||||
* 请使用 useConfigEntity 替代
|
||||
* @deprecated
|
||||
*/
|
||||
export function useEntity<T extends Entity>(
|
||||
entityRegistry: EntityRegistry,
|
||||
autoCreate = true,
|
||||
): T {
|
||||
const entityManager = usePlaygroundContainer().get(EntityManager);
|
||||
const entity = entityManager.getEntity<T>(entityRegistry, autoCreate) as T;
|
||||
const refresh = useRefresh(entity.version);
|
||||
useLayoutEffect(() => {
|
||||
const dispose = entity.onEntityChange(() => {
|
||||
refresh(entity.version);
|
||||
});
|
||||
return () => dispose.dispose();
|
||||
}, [entityManager, refresh, entity]);
|
||||
return entity;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
type WorkflowJSON,
|
||||
type WorkflowDocument,
|
||||
type WorkflowNodeJSON,
|
||||
type WorkflowNodeEntity,
|
||||
} from '@flowgram.ai/free-layout-core';
|
||||
|
||||
/**
|
||||
* 全局的数据转换
|
||||
*/
|
||||
export interface WorkflowJSONFormatContribution {
|
||||
/**
|
||||
* 数据初始化时候调用
|
||||
*/
|
||||
formatOnInit?: (json: WorkflowJSON, doc: WorkflowDocument) => WorkflowJSON;
|
||||
/**
|
||||
* 数据提交时候调用
|
||||
*/
|
||||
formatOnSubmit?: (json: WorkflowJSON, doc: WorkflowDocument) => WorkflowJSON;
|
||||
/**
|
||||
* 转换节点初始化数据
|
||||
* @param data
|
||||
* @param 初始化的参数
|
||||
*/
|
||||
formatNodeOnInit?: (
|
||||
data: WorkflowNodeJSON,
|
||||
doc: WorkflowDocument,
|
||||
isClone?: boolean,
|
||||
) => WorkflowNodeJSON;
|
||||
/**
|
||||
* 统一转换表单提交数据
|
||||
* @param data
|
||||
*/
|
||||
formatNodeOnSubmit?: (
|
||||
data: WorkflowNodeJSON,
|
||||
doc: WorkflowDocument,
|
||||
node: WorkflowNodeEntity,
|
||||
) => WorkflowNodeJSON;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export const WorkflowJSONFormatContribution = Symbol(
|
||||
'WorkflowJSONFormatContribution',
|
||||
);
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {},
|
||||
"types": [],
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"preserveSymlinks": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"module": "ESNext",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../../config/eslint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/stylelint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/ts-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../../config/vitest-config/tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"$schema": "https://json.schemastore.org/tsconfig"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.misc.json"
|
||||
}
|
||||
],
|
||||
"exclude": ["**/*"]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"include": ["__tests__", "stories", "vitest.config.ts", "tailwind.config.ts"],
|
||||
"exclude": ["**/node_modules", "./dist"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {},
|
||||
"types": ["react", "react-dom"],
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"preserveSymlinks": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"module": "ESNext",
|
||||
"rootDir": "./",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { defineConfig } from '@coze-arch/vitest-config';
|
||||
|
||||
export default defineConfig({
|
||||
dirname: __dirname,
|
||||
preset: 'web',
|
||||
});
|
||||
Reference in New Issue
Block a user