superleap-code-editor 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/TYPES.md ADDED
@@ -0,0 +1,140 @@
1
+ # TypeScript Types Reference
2
+
3
+ This document shows how to import and use all TypeScript types available in the `superleap-code-editor` package.
4
+
5
+ ## Importing Types
6
+
7
+ ### Option 1: Import from main package
8
+ ```typescript
9
+ import type {
10
+ CodeEditorConfig,
11
+ FileNode,
12
+ FileProvider,
13
+ UseFileManagerReturn
14
+ } from 'superleap-code-editor';
15
+ ```
16
+
17
+ ### Option 2: Import comprehensive types file
18
+ ```typescript
19
+ import type {
20
+ CodeEditorProps,
21
+ FileExplorerProps,
22
+ WorkflowConfig,
23
+ FormConfig,
24
+ URLConfig,
25
+ SupportedLanguage,
26
+ FileExtension,
27
+ CodeEditorError
28
+ } from 'superleap-code-editor/types';
29
+ ```
30
+
31
+ ## Available Types
32
+
33
+ ### Core Types
34
+ - `FileNode` - Represents a file or folder
35
+ - `FileProvider` - Interface for file data providers
36
+ - `CodeEditorConfig` - Configuration for the code editor
37
+ - `UseFileManagerReturn` - Return type from useFileManager hook
38
+
39
+ ### Component Props
40
+ - `CodeEditorProps` - Props for CodeEditor component
41
+ - `FileExplorerProps` - Props for FileExplorer component
42
+ - `EditorLayoutProps` - Props for EditorLayout component
43
+ - `CodeEditorWrapperProps` - Props for CodeEditorWrapper component
44
+
45
+ ### Configuration Types
46
+ - `WorkflowConfig` - Configuration for workflow-based files
47
+ - `FormConfig` - Configuration for form-based files
48
+ - `URLConfig` - Configuration for URL-based files
49
+ - `EnhancedCodeEditorConfig` - Enhanced configuration with settings
50
+
51
+ ### Hook Types
52
+ - `UseFileManagerOptions` - Options for useFileManager hook
53
+ - `FileManagerState` - State from useFileManager hook
54
+ - `FileManagerActions` - Actions from useFileManager hook
55
+
56
+ ### Utility Types
57
+ - `SupportedLanguage` - Supported programming languages
58
+ - `FileExtension` - Supported file extensions
59
+ - `FileType` - File or folder type
60
+ - `CodeEditorTheme` - Theme configuration
61
+
62
+ ### Error Classes
63
+ - `CodeEditorError` - Base error class
64
+ - `FileProviderError` - File provider errors
65
+ - `FileNotFoundError` - File not found errors
66
+
67
+ ### Constants
68
+ - `SUPPORTED_LANGUAGES` - Array of supported languages
69
+ - `DEFAULT_THEME` - Default theme configuration
70
+ - `DEFAULT_SETTINGS` - Default editor settings
71
+
72
+ ## Usage Examples
73
+
74
+ ### Basic Component Usage
75
+ ```typescript
76
+ import { CodeEditorWrapper } from 'superleap-code-editor';
77
+ import type { CodeEditorConfig } from 'superleap-code-editor';
78
+
79
+ const config: CodeEditorConfig = {
80
+ formConfig: {
81
+ codeContent: 'console.log("Hello World!");',
82
+ fileName: 'example.js',
83
+ language: 'javascript'
84
+ }
85
+ };
86
+
87
+ function App() {
88
+ return <CodeEditorWrapper config={config} />;
89
+ }
90
+ ```
91
+
92
+ ### Advanced Type Usage
93
+ ```typescript
94
+ import type {
95
+ CodeEditorProps,
96
+ SupportedLanguage,
97
+ WorkflowConfig
98
+ } from 'superleap-code-editor/types';
99
+
100
+ const codeEditorProps: CodeEditorProps = {
101
+ value: 'const x = 1;',
102
+ onChange: (value) => console.log(value),
103
+ language: 'typescript' as SupportedLanguage,
104
+ readOnly: false
105
+ };
106
+
107
+ const workflowConfig: WorkflowConfig = {
108
+ functionId: 'func-123',
109
+ version: '1.0.0',
110
+ versionList: ['1.0.0', '1.1.0'],
111
+ fetchFunction: async (id, version) => {
112
+ // Your fetch logic
113
+ return 'function example() { return "Hello"; }';
114
+ },
115
+ fetchVersionList: async (id) => {
116
+ // Your version fetch logic
117
+ return ['1.0.0', '1.1.0'];
118
+ }
119
+ };
120
+ ```
121
+
122
+ ### Hook Usage with Types
123
+ ```typescript
124
+ import { useFileManager } from 'superleap-code-editor';
125
+ import type { UseFileManagerReturn } from 'superleap-code-editor';
126
+
127
+ function MyComponent() {
128
+ const fileManager: UseFileManagerReturn = useFileManager(fileProvider);
129
+
130
+ return (
131
+ <div>
132
+ {fileManager.loading && <div>Loading...</div>}
133
+ {fileManager.error && <div>Error: {fileManager.error}</div>}
134
+ {/* ... */}
135
+ </div>
136
+ );
137
+ }
138
+ ```
139
+
140
+ This comprehensive type system ensures full TypeScript support and IntelliSense for all package features!
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { CodeEditorWrapper } from './components/codeEditorWrapper';
2
- export { CodeEditor } from './components/editor/codeEditor';
3
- export { EditorLayout } from './components/layout/editorLayout';
4
- export { FileExplorer } from './components/panels/fileExplorer';
5
- export { WorkflowFileProvider, FormFileProvider, URLFileProvider, createFileProvider } from './providers/fileProviders';
6
- export { useFileManager } from './hooks/useFileManager';
7
- export type { FileNode, FileProvider, CodeEditorConfig } from './types/fileTypes';
8
- export type { UseFileManagerReturn } from './hooks/useFileManager';
9
- export { WorkflowCodeEditor, FormCodeEditor, URLCodeEditor } from './components/codeEditorWrapper';
10
- export { Splitter, Tree, Button, Tooltip, Alert } from 'antd';
1
+ export { CodeEditorWrapper } from "./components/codeEditorWrapper";
2
+ export { CodeEditor } from "./components/editor/codeEditor";
3
+ export { EditorLayout } from "./components/layout/editorLayout";
4
+ export { FileExplorer } from "./components/panels/fileExplorer";
5
+ export { createFileProvider, FormFileProvider, URLFileProvider, WorkflowFileProvider, } from "./providers/fileProviders";
6
+ export { useFileManager } from "./hooks/useFileManager";
7
+ export type { CodeEditorConfig, FileNode, FileProvider, } from "./types/fileTypes";
8
+ export type { UseFileManagerReturn } from "./hooks/useFileManager";
9
+ export { FormCodeEditor, URLCodeEditor, WorkflowCodeEditor, } from "./components/codeEditorWrapper";
10
+ export { Alert, Button, Splitter, Tooltip, Tree } from "antd";
11
11
  export declare const VERSION = "1.0.0";
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM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AAa,EACb,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG9D,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "superleap-code-editor",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A flexible, reusable code editor component with multiple file handling modes",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "files": [
9
9
  "dist",
10
- "README.md"
10
+ "README.md",
11
+ "TYPES.md"
11
12
  ],
12
13
  "exports": {
13
14
  ".": {
@@ -15,6 +16,7 @@
15
16
  "import": "./dist/index.esm.js",
16
17
  "require": "./dist/index.js"
17
18
  },
19
+ "./types": "./dist/types.d.ts",
18
20
  "./styles": "./dist/style.css"
19
21
  },
20
22
  "scripts": {
@@ -61,21 +63,21 @@
61
63
  },
62
64
  "devDependencies": {
63
65
  "@eslint/js": "^9.33.0",
64
- "@types/react": "^19.1.10",
65
- "@types/react-dom": "^19.1.7",
66
+ "@tailwindcss/vite": "^4.1.13",
67
+ "@types/react": "^18.0.0 || ^19.0.0",
68
+ "@types/react-dom": "^18.0.0 || ^19.0.0",
66
69
  "@vitejs/plugin-react": "^5.0.0",
67
70
  "eslint": "^9.33.0",
68
71
  "eslint-plugin-react-hooks": "^5.2.0",
69
72
  "eslint-plugin-react-refresh": "^0.4.20",
70
73
  "globals": "^16.3.0",
74
+ "react": "^18.0.0 || ^19.0.0",
75
+ "react-dom": "^18.0.0 || ^19.0.0",
76
+ "tailwindcss": "^4.1.13",
71
77
  "typescript": "~5.8.3",
72
78
  "typescript-eslint": "^8.39.1",
73
79
  "vite": "^7.1.2",
74
80
  "vite-plugin-dts": "^4.3.0",
75
- "vite-plugin-lib-inject-css": "^1.3.0",
76
- "react": "^19.1.1",
77
- "react-dom": "^19.1.1",
78
- "tailwindcss": "^4.1.13",
79
- "@tailwindcss/vite": "^4.1.13"
81
+ "vite-plugin-lib-inject-css": "^1.3.0"
80
82
  }
81
83
  }