Skip to content

Commit

Permalink
[editor][wip] Packaging AIConfigEditor Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Holinshead committed Jan 9, 2024
1 parent bcd2921 commit 70327ee
Show file tree
Hide file tree
Showing 63 changed files with 12,244 additions and 34 deletions.
27 changes: 27 additions & 0 deletions python/src/aiconfig/editor/client/editor_package/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
"ignorePatterns": [
"@types/",
"build/",
"node_modules/",
"public/",
"postbuild.js"
]
}
27 changes: 27 additions & 0 deletions python/src/aiconfig/editor/client/editor_package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# AIConfigEditor

This component library provides an AIConfigEditor React component for renderering a customizable AIConfig file editor in React.

## Usage

To render the editor component, simply render an AIConfigEditor within your JSX, passing in an AIConfig object:

```
<AIConfigEditor aiconfig={aiconfig} />
```

## Customization

The editor component can be customized to suit different needs. The following customizations are supported:

### Readonly Editor

// TODO

### Custom Callbacks

// TODO

### Custom Styles

// TODO
64 changes: 64 additions & 0 deletions python/src/aiconfig/editor/client/editor_package/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "aiconfig-editor",
"version": "0.1.0",
"description": "React component for editing aiconfig files",
"author": "LastMile AI",
"license": "UNLICENSED",
"keywords": [
"aiconfig",
"editor",
"react"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "yarn clean && npx tsc",
"clean": "rm -rf dist",
"lint": "eslint . --max-warnings=0"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@mantine/carousel": "^6.0.7",
"@mantine/core": "^6.0.7",
"@mantine/dates": "^6.0.16",
"@mantine/dropzone": "^6.0.7",
"@mantine/form": "^6.0.7",
"@mantine/hooks": "^6.0.7",
"@mantine/modals": "^6.0.7",
"@mantine/notifications": "^6.0.7",
"@mantine/prism": "^6.0.7",
"@monaco-editor/react": "^4.6.0",
"@tabler/icons-react": "^2.44.0",
"aiconfig": "^1.1.3",
"lodash": "^4.17.21",
"node-fetch": "^3.3.2",
"react": "^18",
"react-dom": "^18",
"react-error-boundary": "^4.0.12",
"react-markdown": "^8.0.6",
"react-scripts": "5.0.1",
"remark-gfm": "^4.0.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/lodash": "^4.14.202",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8",
"eslint-config-next": "14.0.2",
"eslint-plugin-react-hooks": "^4.6.0",
"typescript": "^5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const useStyles = createStyles((theme) => ({
},
}));

export default function EditorContainer({
export function AIConfigEditor({
aiconfig: initialAIConfig,
callbacks,
}: Props) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// For now, just export the AIConfigEditor component and relevant types.
export { AIConfigEditor } from "./AIConfigEditor";
export type {
AIConfigCallbacks,
RunPromptStreamCallback,
RunPromptStreamErrorCallback,
RunPromptStreamErrorEvent,
} from "./AIConfigEditor";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./components";
23 changes: 23 additions & 0 deletions python/src/aiconfig/editor/client/editor_package/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"rootDir": "src",
"baseUrl": ".",
"outDir": "dist",
"declaration": true,
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"composite": true
},
"include": ["src"],
"exclude": ["dist", "node_modules"]
}
Loading

0 comments on commit 70327ee

Please sign in to comment.