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',
|
||||
});
|
||||
Reference in New Issue
Block a user