feat: manually mirror opencoze's code from bytedance

Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
fanlv
2025-07-20 17:36:12 +08:00
commit 890153324f
14811 changed files with 1923430 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
const { defineConfig } = require('@coze-arch/stylelint-config');
module.exports = defineConfig({
extends: [],
});

View File

@@ -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

View File

@@ -0,0 +1,12 @@
{
"operationSettings": [
{
"operationName": "test:cov",
"outputFolderNames": ["coverage"]
},
{
"operationName": "ts-check",
"outputFolderNames": ["./dist"]
}
]
}

View File

@@ -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',
},
});

View File

@@ -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"
}
}

View File

@@ -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';

View File

@@ -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';

View File

@@ -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"
}

View File

@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"composite": true
},
"references": [
{
"path": "./tsconfig.build.json"
},
{
"path": "./tsconfig.misc.json"
}
],
"exclude": ["**/*"]
}

View File

@@ -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"
}
}

View File

@@ -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',
});